RTrim as a variable
yes, i pasted old code and didn't notice. i thought i copied the code after
i changed it but i guess i didn't. this is what i came up with and didn't
end up posting
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To LastRow
Range("a" & LastRow).Select
ActiveCell.Formula = RTrim(ActiveCell.Formula)
LastRow = LastRow - 1
Next i
--
Gary
"Norman Jones" wrote in message
...
Hi Gary,
Your procedure only acts on the A1 cell as your code uses the
instruction:
ActiveCell.Formula = RTrim(ActiveCell.Formula)
and, having pre-selected A1, you do not change the active cell.
---
Regards,
Norman
"Gary Keramidas" wrote in message
...
something like this may work if your data is in column A
Option Explicit
Dim rText As String
Dim LastRow As Long
Dim i As Long
Sub Macro1()
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
Range("a1").Select
For i = 1 To LastRow
ActiveCell.Formula = RTrim(ActiveCell.Formula)
Next i
End Sub
--
Gary
"Emory Richter" wrote in message
om...
I would like to use RTrim
to remove spaces from a list of single words.
Every example of RTrim I can find on the web
seems to be for a paticular fixed string like "Hello World ".
If I want to use: RTrim( text )
with 'text' as a variable
to loop down a list, if possible
and remove the trailing spaces
can I substitute something for 'text'
to identify the cell contents ?
That is, how would the following look?
Sub Macro1()
Do Until ActiveCell.Formula = ""
ActiveCell.Offset(1, 0).Select
RTrim( text )
Loop
Thank you,
Emory
|