title: Enable editing vba
body: <p>I am working in Excel 2016. I currently created a macro that will loop through all open workbooks and grab the data in them if they start with the word "report". The issue I am trying to solve now is how to enable editing. If the users enable editing after downloading all reports to be combined there is no issue with the macro. They run into issues with the macro not grabbing the data if they missed that button. </p>
  
  <p>While they are not working with that many workbooks, I am trying to make it easier for them. The code that I have posted will do the first 3 workbooks and then continue looping through the remaining 5 but will not "Enable Edit".  </p>
  
  <pre><code> Sub EnableEdit()
  
   Dim bk As Workbook
   Dim w As Long, wCount As Long
  
   wCount = Application.ProtectedViewWindows.Count
   Set wsh = ThisWorkbook.Worksheets("Data")
  
   On Error Resume Next
      If wCount &gt; 0 Then
          For w = 1 To wCount
              Application.ProtectedViewWindows(w).Activate
              Application.ProtectedViewWindows(w).Edit
  
              If Left(ActiveWorkbook.Name, 6) = "report" Then
                  ActiveWorkbook.Worksheets(1).Range("A1:Z1").Copy _
                      Destination:=wsh.Range("A1")
                  nrow = wsh.Cells(Rows.Count, 1).End(xlUp).Row + 1
                  ActiveWorkbook.Worksheets(1).Range("A2:Z500").Copy _
                      Destination:=wsh.Range("A" &amp; nrow)
                  ActiveWorkbook.Close
              End If
          Next w
      End If
   On Error GoTo 0
  
   End Sub
  </code></pre>