Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default 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.



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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.





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Record Macro and Edit Macro options disabled Huzza New Users to Excel 1 March 18th 09 03:55 PM
how to edit a macro Daniel Excel Discussion (Misc queries) 3 December 11th 07 04:38 PM
How to edit this Macro? yhoy Setting up and Configuration of Excel 3 December 2nd 07 11:21 PM
How to use macro to edit data in Excel cells Annamalai Excel Discussion (Misc queries) 11 September 21st 06 07:44 AM
How do I edit this macro? Mallers Excel Discussion (Misc queries) 5 April 24th 06 07:32 PM


All times are GMT +1. The time now is 03:13 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"