Thanks Thanks:  0
Likes Likes:  0
Results 1 to 4 of 4

Thread: Posting a $ sign in a textbox?

  1. #1
    Board Regular
    Join Date
    Feb 2002
    Posts
    117
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi-
    Textbox1 shows the number listed in range(A1").

    Private sub userform1.activate
    textbox1.text = range(A1")
    end sub

    My question is how do you show that if range "A1" reads $1.23, then I want textbox1 to read $1.23 and not 1.2333333 upon activating the textbox?

  2. #2
    Board Regular
    Join Date
    Feb 2002
    Location
    Stockton, California
    Posts
    281
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    you could try:

    textbox1.text = Format(range(A1"),"$#,##0.00")

    But beware, if youre doing any calculations, this will be a problem (as i found the hard way) and will take some undoing later. The format turns the value into a string.

  3. #3
    Board Regular
    Join Date
    Feb 2002
    Posts
    117
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thanks Robfo1- This worked. Im asuming that if theres a code thats reading textbox1 its reading it as a string instead of a value? How did you go about in correcting that problem?

  4. #4
    Board Regular
    Join Date
    Mar 2002
    Posts
    363
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    You can link a text box to a range without using VBA by clicking on the text box and typing "=A1" in the formula bar. The contents of cell A1 (including its format) will be displayed in the text box. Format cell A1 as $.
    It's never too late to learn something new.

    Ricky

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
  •