printmedia
asked on
Left trim cells in column A Excel vba
Hi all.
I would like to remove any leading blank spaces for each cell in column A starting with A3 and going down as far as there is data using VBA.
I've tried the following but it's giving me an error: For Each may only iterate over a collection object or an array.
Any help would be appreciated.
I would like to remove any leading blank spaces for each cell in column A starting with A3 and going down as far as there is data using VBA.
I've tried the following but it's giving me an error: For Each may only iterate over a collection object or an array.
Dim r As Long
Dim Rng As Range
With Worksheets("Sheet1")
r = .Range("A3" & Rows.Count).End(xlUp).Row
For Each Rng In r
Rng.Value = VBA.LTrim(Rng.Value)
Next
End With
Any help would be appreciated.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window