As long as your sheet formats are consistent, you can actually get the code you need for the formatting of the sheet (removing merges, rearranging columns, etc) by turning on your Macro Recorder and record yourself doing performing those steps manually on one sheet, and then stopping the Macro Recorder. This will give you the code you need for that part.
Then, we can drop the code into some VBA code that loops through your folder, opens each workbook, makes the changes to each sheet, and then save and closes it.
Here is the "shell" for that code:
VBA Code:
Sub MyFormattingFixMacro()
Dim pth As String
Dim ext As String
Dim fl As String
Dim wb As Workbook
Dim ws As Worksheet
Application
' Enter path and file extension to look for
pth = "C:\Users\Abdo\Desktop\TYR\"
ext = "*.xls*"
' Target path and extension
fl = Dir(pth & ext)
' Loop through each Excel file in folder
Do While fl <> ""
' Open workbook and assign to object variable
Set wb = Workbooks.Open(Filename:=pth & fl)
' Loop through all sheets
For Each ws In wb.Worksheets
'***********YOU WOULD ACTUALLY HAVE YOUR CODE BELOW*******************
MsgBox "Worksheet: " & ws.Name
Next ws
' Close workbook
wb.Close SaveChanges:=True
' Get next file name
fl = Dir
Loop
End Sub
So you would just replace this section of that code:
VBA Code:
'***********YOU WOULD ACTUALLY HAVE YOUR CODE BELOW*******************
MsgBox "Worksheet: " & ws.Name
with the code you recorded.
Just note two things:
1. You may want to clean-up your recorded code a bit to get rid of all the "Select" and "ActiveCell" references - the Macro Recorder is very literal, and records every motion, so some lines can be combined and/or eliminated. We can help you with this part if you post the code you recorded.
2. Be sure to update all the Range references in your recorded code with the "ws." prefix, which tells it which sheet to apply to.
So, if you have a reference like this:
you would want to change it to this: