ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   edit the contents of a cell using a macro (https://www.excelbanter.com/excel-programming/346865-edit-contents-cell-using-macro.html)

stinson

edit the contents of a cell using a macro
 
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.

sebastienm

edit the contents of a cell using a macro
 
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
--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"stinson" wrote:

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.



All times are GMT +1. The time now is 11:50 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com