Hi There,
I'm having trouble with a piece of code that i've used in the past but for some reason is now skipping without performing the intended formatting. The idea is to open each file in a specified folder and perform a formatting function before saving it again. Right after the Do While command, it just skips to the bottom and I can't understand why.
Code
Dim FolderPath As String
Dim FileName As String
FolderPath = "C:\Users\jjones\Desktop\Macros\Testing\Division Files"
FileName = Dir(FolderPath & "*.xls*")
Do While FileName <> ""
Workbooks.Open (FolderPath & FileName), UpdateLinks:=0
If ActiveSheet.AutoFilterMode = True Then ActiveSheet.AutoFilterMode = False
With Workbook.Worksheets(2)
Range("E19").Select
ActiveWindow.FreezePanes = True
Rows("18:18").Select
With ActiveSheet.PageSetup
.PrintTitleRows = "$18:$18"
.PrintTitleColumns = ""
End With
Workbooks(FileName).Close SaveChanges:=True
FileName = Dir()
Loop
Display More
Thanks for your help!!!