Keyboard Macro Just Copies Content of Previous Cell

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I created a simple keyboard macro to edit the contents of a cell by simply
inserting a "b" in a particular position. For example, I have a series of
alphanumeric numbers that start with S1253, e.g., S12536675. I wanted to
insert a "b" after the first five digits on the left to revise the series of
alphanumeric numbers to start with S1253b, e.g..S1253b6675. However, after
creating the keyboard macro, when I run the macro on the next cell to be
edited (i.e., S12536676), the macro simply copies the contents of the
original cell that I edited when I first created the keyboard macro (i.e.,
S1253b6675), rather than simply inserting a "b" n the fifth position from the
left as I desired. Any ideas on what is going on here???
 
It is probably hard-coded as say

Activecell.Value = "S1253b6675"

change it to

With Activecell
.Value = Left(.value,4) & "b" & _
Right(.Value, Len(.Value) - 4)
End WIth

--

HTH

RP
(remove nothere from the email address if mailing direct)
 

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

Back
Top