PC Review


Reply
Thread Tools Rate Thread

Add leading Zeros to number

 
 
jack
Guest
Posts: n/a
 
      1st Sep 2003
Hello,

I have a number that is 6 places long.

I would like:

"16" to be "000016"
"116" to be "000116"

and so on.

Any help whould be great!!

Thanks,

Jack


 
Reply With Quote
 
 
 
 
Mark Keogh
Guest
Posts: n/a
 
      1st Sep 2003
Number.ToString.PadLeft(6, "0"c)



"jack" <(E-Mail Removed)> wrote in message
news:eG$(E-Mail Removed)...
> Hello,
>
> I have a number that is 6 places long.
>
> I would like:
>
> "16" to be "000016"
> "116" to be "000116"
>
> and so on.
>
> Any help whould be great!!
>
> Thanks,
>
> Jack
>
>



 
Reply With Quote
 
jack
Guest
Posts: n/a
 
      1st Sep 2003
Hello,

Thanks for the quick reply. How do I have the formating done on a var like
CounterCount?

Thanks,

Jack

"Mark Keogh" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Number.ToString.PadLeft(6, "0"c)
>
>
>
> "jack" <(E-Mail Removed)> wrote in message
> news:eG$(E-Mail Removed)...
> > Hello,
> >
> > I have a number that is 6 places long.
> >
> > I would like:
> >
> > "16" to be "000016"
> > "116" to be "000116"
> >
> > and so on.
> >
> > Any help whould be great!!
> >
> > Thanks,
> >
> > Jack
> >
> >

>
>



 
Reply With Quote
 
Mark Keogh
Guest
Posts: n/a
 
      1st Sep 2003
Exactly the same,

CounterCount.ToString.PadLeft(6, "0"c)

HTH


"jack" <(E-Mail Removed)> wrote in message
news:#(E-Mail Removed)...
> Hello,
>
> Thanks for the quick reply. How do I have the formating done on a var

like
> CounterCount?
>
> Thanks,
>
> Jack
>
> "Mark Keogh" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
> > Number.ToString.PadLeft(6, "0"c)
> >
> >
> >
> > "jack" <(E-Mail Removed)> wrote in message
> > news:eG$(E-Mail Removed)...
> > > Hello,
> > >
> > > I have a number that is 6 places long.
> > >
> > > I would like:
> > >
> > > "16" to be "000016"
> > > "116" to be "000116"
> > >
> > > and so on.
> > >
> > > Any help whould be great!!
> > >
> > > Thanks,
> > >
> > > Jack
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
jack
Guest
Posts: n/a
 
      1st Sep 2003
Thanks!!!

"Mark Keogh" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Exactly the same,
>
> CounterCount.ToString.PadLeft(6, "0"c)
>
> HTH
>
>
> "jack" <(E-Mail Removed)> wrote in message
> news:#(E-Mail Removed)...
> > Hello,
> >
> > Thanks for the quick reply. How do I have the formating done on a var

> like
> > CounterCount?
> >
> > Thanks,
> >
> > Jack
> >
> > "Mark Keogh" <(E-Mail Removed)> wrote in message
> > news:%(E-Mail Removed)...
> > > Number.ToString.PadLeft(6, "0"c)
> > >
> > >
> > >
> > > "jack" <(E-Mail Removed)> wrote in message
> > > news:eG$(E-Mail Removed)...
> > > > Hello,
> > > >
> > > > I have a number that is 6 places long.
> > > >
> > > > I would like:
> > > >
> > > > "16" to be "000016"
> > > > "116" to be "000116"
> > > >
> > > > and so on.
> > > >
> > > > Any help whould be great!!
> > > >
> > > > Thanks,
> > > >
> > > > Jack
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      1st Sep 2003
Hello,

"jack" <(E-Mail Removed)> schrieb:
> I have a number that is 6 places long.
>
> I would like:
>
> "16" to be "000016"
> "116" to be "000116"
>
> and so on.
>
> Any help whould be great!!


\\\
MsgBox(Format(16, "000000"))
///

HTH,
Herfried K. Wagner
--
MVP · VB Classic, VB .NET
http://www.mvps.org/dotnet


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need 7 digit number with differnt number of leading zeros malycom Microsoft Excel Misc 10 30th Jul 2009 04:02 PM
putting zeros to certain number of leading bits in a number in VB =?Utf-8?B?Q2hlcmlmIERpYWxsbw==?= Microsoft Dot NET Framework 3 13th Jan 2006 07:57 AM
How do I add three leading zeros to a number field ? =?Utf-8?B?RGVjZW1iZXJzb25hdGE=?= Microsoft Access 2 4th Nov 2005 04:23 PM
Spliting a number with leading zeros haitch2 Microsoft Excel Misc 7 30th Sep 2005 12:09 AM
Number with leading zeros SteveM Microsoft Excel Worksheet Functions 3 2nd Feb 2004 04:47 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:53 PM.