edit the contents of a cell using a macro

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How can I edit the contents or the string in a cell? For example, if a cell
has text that is followed by blank spaces, I would like a macro to look at
the contents of the cell, look for the blank spaces, and then delete the
blank spaces.
 
Hi,

Try something like:
Dim cell as Range
set cell = Range("A1") 'range a1 of active sheet
cell.Value = Trim(cell.Text) 'remove trailing spaces with and reassign
to the cell
 
Back
Top