Specific format

  • Thread starter Thread starter Basta1980
  • Start date Start date
B

Basta1980

Hi All,

Hope you can help me (think it's fairly easy). In column A there's list of
numbers (9 characters long). One of our systems requires that the list of
numbers (or per number) is preceded by 2 zero's, ie. 12345678 becomes
0012345678. I reckon a cut/copy and paste is a good option but (off course)
I'm looking for a piece of programming that changes the numbers into the
desired format.

Thnx in advance

Basta1980
 
Mike,

Right, good question. Did I forget to mention that our system doesn't work
along with this solution. Thing is, in column A (or cel A1) for that matter
you can see 00123456789 but it actually is just a change in format (as you
suggested), i.e. in the function bar 123456789 is still displayed and this is
copied (and therefore does not work in my case).

Greetz

Basta1980
 
Hi,

Then maybe a small macro

Sub add_Lead_Zeroes()
For Each c In Selection
With c
.NumberFormat = "@"
.Value = "00" & c.Value
End With
Next
End Sub

Mike
 
Back
Top