Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 2 of 2

Thread: convert integer variable into a formatted string

  1. #1
    New Member
    Join Date
    Feb 2002
    Posts
    3
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    LoopP is an integer variable from 1 to 60.
    I need to get a string "01" through "60".
    Simple Str(LoopP) can not work.
    How to realise this?
    Another question is to conver it to "0001" through "0060". How? Please give suggestions. TIA

  2. #2
    Board Regular
    Join Date
    Feb 2002
    Location
    Bushkill, PA
    Posts
    54
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Use the format command:

    Mystr=format(loopP,"00") gives you 01,02, etc

    Mystr=format(loopP,"0000") gives you 0001, 0060, etc

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •