Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Getting a number from a textbox to use in a vb formula
I have a text box that will only have a number entered into it. I want to
capture that number as a variable, and use it in a formula as part of a macro. Using a Textbox entry of .1734 and code: af = Sheet("Data").Textbox3.value yields af=".1734" , and gives a formula result of "empty" I set up a linked cell, B2, formated as number, 4 decimal places. Code: af = Sheet("Data").Cells(2,2).value is the same as above. If I replace value with "formula" I get af = 0 I'm stumpped! Art |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Getting a number from a textbox to use in a vb formula
I don't have forms with my version of Excel so I can't try my theory out but
I think your problem is your number is really text. Try this: af = val(Sheet("Data").Textbox3.value) This would convert your text to a value. HTH Chris "Art Dawson" wrote in message ... I have a text box that will only have a number entered into it. I want to capture that number as a variable, and use it in a formula as part of a macro. Using a Textbox entry of .1734 and code: af = Sheet("Data").Textbox3.value yields af=".1734" , and gives a formula result of "empty" I set up a linked cell, B2, formated as number, 4 decimal places. Code: af = Sheet("Data").Cells(2,2).value is the same as above. If I replace value with "formula" I get af = 0 I'm stumpped! Art |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Number format TextBox? | Excel Discussion (Misc queries) | |||
Assigning Row Number to TextBox | Excel Discussion (Misc queries) | |||
Userform textbox number formats | Excel Discussion (Misc queries) | |||
Textbox number formatting | Excel Programming | |||
textbox.value doesn't create a number? | Excel Programming |