I am trying to get Column A to trim down because of extra spaces in it. I need to do this across 29 sheets and can not get the formula to work.
Here is what I am trying to use
Sub TrimSpaces()
Application.ScreenUpdating = False
For Each sh In Worksheets
If sh.Name <> "Emall" And sh.Name <> "FPDSNG" Then
sh.Activate
Range("A2:A40000").Select
For Each cell In Selection
cell.Value = Trim(cell.Value)
End If
Next sh
Application.ScreenUpdating = True
MsgBox "Data has been updated. "
End Sub
I get a "Compile Error: End If without Block If
Any help would be greatly appreciated.
Bookmarks