I would like to trim leading spaces to the left in Col A on sheets BR1_sales to BR12_Sales
However, when running the macro , I get a compile error: "invalid next control variable reference"
It would be appreciated if someone could kindly amend my code
Code:
Sub Remove_Leading_Spaces_CommSheets()
Dim I As Long, LR As Long
For I = Worksheets("BR1_Sales").Index To Worksheets("BR12_sales").Index
With Worksheets(I)
LR = .Cells(Rows.Count, "A").End(xlUp).Row
For Each r In ActiveSheet.Range("A1:A" & LR)
If Left(r.Value, 1) = " " Then r.Value = Right(r.Value, Len(r.Value) - 1)
Next I
Next r
End With
End Sub
However, when running the macro , I get a compile error: "invalid next control variable reference"
It would be appreciated if someone could kindly amend my code