![]() |
How do Macro to EDIT cells?
Am using MS Excel XP (2002). All I want to do is a short macro to, in
effect, press F2 (to EDIT the cell), then let's say delete the first character of the cell and change it to let's say X, like this... Befo _Mary Jones *Joe Smith %Peter Rabbbit After: XMary Jones XJoe Smith XPeter Rabbbit I just want to put the cursor on a given cell, click CNTL-A to run the macro, and have it change one cell at a time. There are reasons why I can't use the search and replace. Problem is... if I record the macro (turn it on, press the key sequences, F2, Home, Delete, X, GoDownOneCell, turn it off), it puts XMary Jones in all the cells, like this (I think it isn't interpretting the F2 key correctly)... After: XMary Jones XMary Jones XMary Jones Would appreciate any suggestions, thanks, George. |
How do Macro to EDIT cells?
Sub ReplaceFirstCharacter()
Dim cell as Range for each cell in selection.SpecialCells(xlConstants,xlTextValues) cell.Value = "X" & Right(cell.value, len(cell.value)-1) Next End Sub select the cells and then run the macro. -- Regards, Tom Ogilvy "George" wrote in message ... Am using MS Excel XP (2002). All I want to do is a short macro to, in effect, press F2 (to EDIT the cell), then let's say delete the first character of the cell and change it to let's say X, like this... Befo _Mary Jones *Joe Smith %Peter Rabbbit After: XMary Jones XJoe Smith XPeter Rabbbit I just want to put the cursor on a given cell, click CNTL-A to run the macro, and have it change one cell at a time. There are reasons why I can't use the search and replace. Problem is... if I record the macro (turn it on, press the key sequences, F2, Home, Delete, X, GoDownOneCell, turn it off), it puts XMary Jones in all the cells, like this (I think it isn't interpretting the F2 key correctly)... After: XMary Jones XMary Jones XMary Jones Would appreciate any suggestions, thanks, George. |
All times are GMT +1. The time now is 03:37 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com