![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Posts: 117
|
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 |
|
Board Regular
Join Date: Feb 2002
Location: Stockton, California
Posts: 281
|
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 |
|
Board Regular
Join Date: Feb 2002
Posts: 117
|
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 |
|
Board Regular
Join Date: Mar 2002
Posts: 363
|
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 |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|