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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel Macro

Status
Not open for further replies.

jmuscat

Instructor
May 22, 2002
54
AU
I am wanting to create a macro that will add a zero to the front of certain cell numbers.
I cannot seem to work it out.
Say column A has 856, I need a macro to change it to 0856, but also use the macro on other values in other cells.
Any ideas
 
Hi,

What do the other cells contain? Do the cells you want to change have anything in common? Are they in the same row or column, all three digits long, or any other formulaic properties that are identical throughout?

I need to know the pattern of the cells so a criteria-specific search can made of the cells that contain the numbers you want. Let me know and I'll come up with something for you..

Cheers,

Renegade..


BULLET-PROOF DESiGNZ
renegade@tiscali.co.uk
 
Basically the cells contain random numbers anything from 856 to 1245634.
In some instances, not all, I need to add an extra zero at the front of the number. The only common factor would be that all the numbers reside in column A.
Many thanks
 
Hi jmuscat,

are these cells in column A numeric, or text? If they are numeric, will changing the number format to "0000" be sufficient for you?


Glenn.
 
Easy - add a ' (apostrophe) before you type a cell number or an area code - the ' (apostrophe) identifies the cell then as text.
alternatively
Select all the cells where you will be inserting figures with zeros infront,
point to the selected area,
right click,
select Format Cells,
Click the NUMBER tab
Select Text
Click ok

Alma

Miracles we do immediately ...
imposibilities take a little longer.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top