#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default excel macro

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
mp mp is offline
external usenet poster
 
Posts: 70
Default excel macro



"Rose Men" wrote in message
...
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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default excel macro

On Feb 18, 1:44*pm, "mp" wrote:
"Rose Men" wrote in message

...
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
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default excel macro

on 2/18/2011, Rose Men supposed :
Hi ,
I have a record character variable which has less than 9 length,
I need converted to a 9 character text field with leading 0s.
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[s] number format to custom, defined as:

00000000#

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc


  #5   Report Post  
Posted to microsoft.public.excel.programming
mp mp is offline
external usenet poster
 
Posts: 70
Default excel macro


"Rose Men" wrote in message
...
On Feb 18, 1:44 pm, "mp" wrote:
"Rose Men" wrote in message

...
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




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default excel macro

Rose Men pretended :
On Feb 18, 1:44*pm, "mp" wrote:
"Rose Men" wrote in message

...
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


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

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 3 February 5th 07 08:22 PM
Need syntax for RUNning a Word macro with an argument, called from an Excel macro Steve[_84_] Excel Programming 3 July 6th 06 07:42 PM
translate lotus 1-2-3 macro into excel macro using excel 2000 krutledge0209 Excel Programming 1 November 2nd 04 05:50 PM


All times are GMT +1. The time now is 07:24 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"