excel macro

R

Rose Men

Hi ,
I have a record character variable which has less than 9 length,
I need converted to a 9 character text field with leading 0’s.
how can i coded in MACRO so that I can automaticly transfer them to 9
length next time when I get more data to excel.
Thank you very much.
Rose
 
M

mp

Hi ,
I have a record character variable which has less than 9 length,
I need converted to a 9 character text field with leading 0’s.
how can i coded in MACRO so that I can automaticly transfer them to 9
length next time when I get more data to excel.
Thank you very much.
Rose

check out Format function
format(1,"00000000#")
format(12,"00000000#")
format(123,"00000000#")
format(1234,"00000000#")
etc
hth
mark
 
R

Rose Men

Hi ,
I have a record character variable which has less than 9 length,
I need converted to a 9 character text field with leading 0 s.
how can i coded in MACRO so that I can automaticly transfer them to 9
length next time when I get more data to excel.
Thank you very much.
Rose

check out Format function
format(1,"00000000#")
format(12,"00000000#")
format(123,"00000000#")
format(1234,"00000000#")
etc
hth
mark

Can i write a code in a sub function using VBA to do it automaticaly?
thanks,
Rose
 
G

GS

Hi ,
I have a record character variable which has less than 9 length,
I need converted to a 9 character text field with leading 0’s.
how can i coded in MACRO so that I can automaticly transfer them to 9
length next time when I get more data to excel.
Thank you very much.
Rose

You could have Excel do this automatically by setting the target
cell number format to custom, defined as:

00000000#
 
M

mp

Hi ,
I have a record character variable which has less than 9 length,
I need converted to a 9 character text field with leading 0 s.
how can i coded in MACRO so that I can automaticly transfer them to 9
length next time when I get more data to excel.
Thank you very much.
Rose

check out Format function
format(1,"00000000#")
format(12,"00000000#")
format(123,"00000000#")
format(1234,"00000000#")
etc
hth
mark

Can i write a code in a sub function using VBA to do it automaticaly?
thanks,
Rose

Yes of course, but go with GS's suggestion...it's much better than mine
you won't even need to write and call a macro that way.
mark
 
G

GS

Rose Men pretended :
Can i write a code in a sub function using VBA to do it automaticaly?
thanks,
Rose

Nothing you write in VBA will work as well, fast, or efficient as
Excel's built-in features.
 

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