Dear Friends,
I have a workbook with 4 sheets. Each sheet contains more than one lakh rows & minimum column From A to BR.
I wish to trim all cells of all sheets at a time. I got a VBA query from web which is not working properly:
Sub RemoveTrailingSpaces()
Dim Col As Range, combo As String
Application.ScreenUpdating = False
For Each Col In ActiveSheet.UsedRange.Columns
combo = Join(WorksheetFunction.Transpose(Col), Chr(1))
Do While InStr(combo, " " & Chr(1))
combo = Replace(combo, " " & Chr(1), Chr(1))
Loop
Col = WorksheetFunction.Transpose(Split(combo, Chr(1)))
Next
Application.ScreenUpdating = True
End Sub
After a certain row all cells are showing #N/A after running the above mentioned query.
I need help to get it done. Please help
Regards
RAMU
I have a workbook with 4 sheets. Each sheet contains more than one lakh rows & minimum column From A to BR.
I wish to trim all cells of all sheets at a time. I got a VBA query from web which is not working properly:
Sub RemoveTrailingSpaces()
Dim Col As Range, combo As String
Application.ScreenUpdating = False
For Each Col In ActiveSheet.UsedRange.Columns
combo = Join(WorksheetFunction.Transpose(Col), Chr(1))
Do While InStr(combo, " " & Chr(1))
combo = Replace(combo, " " & Chr(1), Chr(1))
Loop
Col = WorksheetFunction.Transpose(Split(combo, Chr(1)))
Next
Application.ScreenUpdating = True
End Sub
After a certain row all cells are showing #N/A after running the above mentioned query.
I need help to get it done. Please help
Regards
RAMU