Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Number format TextBox? hoyos Excel Discussion (Misc queries) 2 November 8th 09 11:04 PM
Assigning Row Number to TextBox Ayo Excel Discussion (Misc queries) 0 May 30th 08 08:24 PM
Userform textbox number formats PhilM Excel Discussion (Misc queries) 2 June 7th 06 11:08 AM
Textbox number formatting Mike[_60_] Excel Programming 1 November 14th 03 10:03 PM
textbox.value doesn't create a number? Larry Levinson Excel Programming 2 September 5th 03 05:52 PM


All times are GMT +1. The time now is 01:05 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"