ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Keyboard Macro Just Copies Content of Previous Cell (https://www.excelbanter.com/excel-discussion-misc-queries/52013-keyboard-macro-just-copies-content-previous-cell.html)

Andy

Keyboard Macro Just Copies Content of Previous Cell
 
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???
--
Andy

Bob Phillips

Keyboard Macro Just Copies Content of Previous Cell
 
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)


"Andy" wrote in message
...
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???
--
Andy





All times are GMT +1. The time now is 10:48 PM.

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