Need help removing leading zeros from a list of numbers

L

Lee

I have a list of numbers that have zeros in front of them
that I want to remove. The list is quite long, so I am
trying to find out how to do this either under formatting
or by use of a macro. Some of the numbers have only one
zero in front, while others have as many as three zeros in
front.

PLEASE HELP!!! WHAT DO I DO??

THANKS!!!
 
F

Frank Kabel

Hi
try the following macro
sub foo()
with activesheet.range("A1:A100")
.numberformat = "0"
.value = .value
end with
end sub
 
L

Lee

Frank,

That macro didn't work.

Thank you very much for the help, though. If you have any
other suggestions, let me know.

Lee
 
D

Dave R.

You stated that you have NUMBERS with leading 0s. Are they really NUMBERS or
do they have some text in them as well?
 
H

Harlan Grove

try the following macro
sub foo()
with activesheet.range("A1:A100")
.numberformat = "0"
.value = .value
end with
end sub
...

If it's just a matter of formatting, then no need for a macro - select the range
and change the format. If it's just a matter of numbers stored as text, then
again no need for a macro - select the range and run Data > Text to Columns,
Delimited, click Next then click Finish.
 
F

Frank Kabel

Hi
this should work if you only have numbers in these cells (tthough
Harlan's solution is easier to apply).
Does Harlan's solution work for you?
 

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

Top