Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel Macro to edit cell data

Status
Not open for further replies.

alan14

Technical User
Jun 1, 2003
11
NZ
Is it possible to record a macro in excel that you can call to perform the exact same keystrokes you recorded.
I want to edit part of the data in the certain cells.
Example: I would like the macro to do the following:

F2
Home
Right
Right
Right
\Alan
Delete
Delete
Delete
Enter

When I record the above macro (in cell A1) for instance the move to cell B6 and invoke the macro it changes the data in B6 to what is in A1 instead of performing the keystrokes as recorded.
And help would be appreciated
Cheers
 



Hi,

What you are describing is a keystroke macro, which is not what Excel macros does.

Please describe WHAT you are trying to do, rather than HOW you want it done.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Have a look at the Replace function:
=REPLACE(E41,4,3,"\Alan") would achieve something like you want.
Now you could do that sort of thing within a macro but (just guessing) I wonder if
Edit, Links, ChangeSource would help?

Gavin
 
Thank you . You have answered my question, that Excel does NOT record keystrokes it actually records what you have done and translates that into VBA.
I'm sure that earlier versions used to record keystrokes or maybe it was Quattro or Lotus 123!!!
Cheers
Alan
 
You could use the sendkeys method to perform keystrokes but it's not advisable as it doesn;t take account of anything else happening on your computer...for example, an outlook message popping up or an autosave happening

Best bet as Skip / Gavona have stated is to explain what you want to do and we should be able to help code it

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top