![]() |
![]() |
|
|||||||
| 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: Apr 2002
Location: NSW. Australia
Posts: 64
|
I have a form with several text boxes. Is there any way of changing the format when it is transferred into the workbook. I need some to be formatted as text, others as numbers, one as currency and one as date.
|
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Feb 2002
Posts: 117
|
Select the cells on the sheet that needs to bo formated and go to format/cells from your menue. there you can format those cells as you wish.
|
|
|
|
|
|
#3 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Columbus, OH, USA
Posts: 3,519
|
When you say "it" is transferred to the worksheet, I'm assuming you mean the text in the textbox?
Have a look at the "Format" command in VBA help. HTH |
|
|
|
|
|
#4 |
|
Board Regular
Join Date: Feb 2002
Posts: 117
|
Or you could do it in code:
Format((Range("j2").Value), "$#,##0.00")=TextBox1.Text |
|
|
|
|
|
#5 |
|
Board Regular
Join Date: Apr 2002
Location: NSW. Australia
Posts: 64
|
I was hopeing that there would be a setting in the textbox properties that could be changed. I have tried using code and the date worked fine but not the others.
Thanks |
|
|
|
|
|
#6 |
|
Board Regular
Join Date: Feb 2002
Posts: 117
|
Change that to:
Range("j2")=Format((TextBox1.Text), "$#,##0.00") |
|
|
|
|
|
#7 |
|
Board Regular
Join Date: Apr 2002
Location: NSW. Australia
Posts: 64
|
Thanks Todd_M
Your second code worked perfectly. |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|