edit the contents of a cell using a macro

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.
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top