View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett[_4_] Don Guillett[_4_] is offline
external usenet poster
 
Posts: 2,337
Default use macro to insert characters at the beginning of a string

try
Sub addleading19()
For Each c In Selection
c.Value = "19" & c
Next
End Sub

--
Don Guillett
SalesAid Software

"dcmackie" wrote in message
...
I thought his would be the simplest of macros !

I need to add "19" to the beginning of the description of an asset to
correct two digit years to four.

I recorded my steps ie. F2 key , then home then right arrow the 19 then an
enter key to move down to the next cell.

If the next cell needs correction and I run the macro created by my
recording, rather than correcting the new cell, ie. adding "19" to the
beginning, it inserts the corrected contents of the previous cell on which
the macro was run.

Engaging the relative reference key does not help.