This will get the trailing spaces..
Sub TrimTrailingSpaces()
Dim LR As Long 'Use Long as Integer can only handle 32,767
Dim myRng As Range 'I am going to name the used range
Dim ws As Worksheet 'Declare worksheet as variable
Dim cll As Range
Set ws = ThisWorkbook.Worksheets("Sheet2") 'Want to be specific on the worksheet used
LR = ws.Cells(Rows.Count, 1).End(xlUp).Row 'Find the last row in Col A. Do not include the whole column of over 1 million cells
Set myRng = ws.Range(ws.Cells(2, 1), ws.Cells(LR, 1)) 'Declare the range used
For Each cll In myRng 'cll is a Cell in a Collection of Cells in a Range that we defined
cll = RTrim(cll) 'Looping through, modify each cell
Next cll 'Go to the next Cell
End Sub
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…