title: vba macro looping through files but failing to loop through worksheets
body: <p>I've created a vba macro with the intention of:
  1) Opening each file in a folder one by one
  2) Loop through each worksheet, unprotect each sheet see if the top row is blank (and delete it if it is) and delete a problematic column.
  3) Save the file as an xlsx.</p>
  
  <p>So far I've managed to get it to loop through every file but fail to loop through the worksheets. I was previously able to get it to make changes to the last active worksheet in each workbook but now it seems to skip every worksheet.</p>
  
  <p>Any idea why?</p>
  
  <pre><code>Sub LoopThroughFiles()
  
      FolderName = ThisWorkbook.Path &amp; "\Source Data\"
      If Right(FolderName, 1) &lt;&gt; Application.PathSeparator Then FolderName = FolderName &amp; Application.PathSeparator
      Fname = Dir(FolderName &amp; "*.xls*")
  
      'loop through the files
      Do While Len(Fname)
  
          With Workbooks.Open(FolderName &amp; Fname)
      Dim folderPath As String
      Dim filename As String
      Dim wb As Workbook
      Dim ws As Worksheet
  
  
  Application.DisplayAlerts = False
  Application.AskToUpdateLinks = False
  
  'Unshare Workbook
  If ActiveWorkbook.MultiUserEditing Then
      ActiveWorkbook.ExclusiveAccess
  End If
  
  'Unprotect Workbook
  ActiveWorkbook.Unprotect "pa55word"
  
  
  For Each ws In ThisWorkbook.Worksheets
  
  'Unprotect Worksheet
  ws.Unprotect "pa55word"
  
  'Unhide Columns and Rows
              ws.Cells.EntireColumn.Hidden = False
              ws.Cells.EntireRow.Hidden = False
  
  
   'Delete Blank top Row
   Set MR = ws.Range("A1:C1")
   For Each cell In MR
   If cell.Value = "" Then cell.EntireRow.Delete
   Next
  
    'Delete annoying Column
   Set MR = ws.Range("A1:BZ1")
   For Each cell In MR
   If cell.Value = "a2a" Then cell.EntireColumn.Delete
   Next
  
   'Remove Filter
  
   If ws.AutoFilterMode Then
   ws.ShowAllData
   ws.AutoFilterMode = False
   End If
  
   Next ws
  
  
  ActiveWorkbook.SaveAs ThisWorkbook.Path &amp; "\Cleansed Data\" &amp; Replace(Replace(ActiveWorkbook.Name, ".xlsx", ""), ".xls", "") &amp; ".xlsx", FileFormat:=51
  ActiveWorkbook.Close
  
          End With
  
          ' go to the next file in the folder
          Fname = Dir
  
      Loop
  
  
  
  End Sub
  </code></pre>