Back again. I am trying to use For Each ws to loop a formatting macro through all worksheets except one. The issue is, it seems that the macro is looping the formatting code through only the first worksheet (it's not actually moving on to the next). I have no idea where I am going wrong. Below is the code that I am using. TIA
Code:
Option Explicit
Sub Combine_Exports()
Dim FolderPath As String
Dim Filename As String
Dim ws As Worksheet
Dim wkb As Workbook
Dim WS_Count As Integer
Dim I As Integer
'Copy worksheets to master file
Application.ScreenUpdating = False
Application.DisplayAlerts = False
FolderPath = "C:\Documents\"
Filename = Dir(FolderPath & "*.xlsx*")
Do While Filename <> ""
Workbooks.Open Filename:=FolderPath & Filename, ReadOnly:=True
For Each ws In ActiveWorkbook.Sheets
ws.Copy After:=ThisWorkbook.Sheets(1)
Next ws
Workbooks(Filename).Close
Filename = Dir()
Loop
'Format Worksheet Data
For Each ws In ThisWorkbook.Worksheets
If ws.Name <> "Macro" Then
Call Format_WS
End If
Next ws
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
Option Explicit
Sub Format_WS()
Dim ws As Sheets
Dim wkb As Workbook
Dim Rng As Range
Dim I As Long
Dim FinalRow As Long
Dim LRow As Long
Application.ScreenUpdating = False
Application.DisplayAlerts = False
'Delete Rows
Range("A1:A4").EntireRow.Delete
'Format Fields
Range("C1") = Range("C1") & " " & Range("C2")
Range("F1") = "Grade"
Range("G1") = Range("G1") & " " & Range("G2")
Range("H1") = Range("H1") & " " & Range("H2")
Range("J1") = Range("J1") & " " & Range("J2")
Range("K1") = Range("K1") & " " & Range("K2")
Range("L1") = Range("L1") & " " & Range("L2")
Range("A1:L2").Cut Destination:=Range("B1")
Range("A2").EntireRow.Delete
Range("A1").Select
ActiveCell.Value = "Unit #"
Range("M:N").EntireColumn.Delete
'Delete Cells with Text in Column A (Unit #)
FinalRow = Cells(Rows.Count, 1).End(xlUp).Row
For I = FinalRow To 2 Step -1
If IsEmpty(Cells(I, 4)) = True Then
Cells(I, 4).EntireRow.Delete
End If
Next I
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub