Getting a number from a textbox to use in a vb formula

  • Thread starter Thread starter Art Dawson
  • Start date Start date
A

Art Dawson

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
 
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
 
Back
Top