Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default get cell value to textbox

Great forum - thanks to all for making it possible

I am trying to use the value a user will type into a
textbox on one userform to determine the value that will
be displayed in a textbox on another userform.

I know the range of numbers the user will type and I have
set up the underlying sheet to have the information I
want to retreive in the row corresponding to that number.
ie: user types 50, the answer I want to disply will be in
row 50.

There are 2 option button also whose choice combination
will determine which column to get the info from.

I have used code like: (this is in it's own module)

Sub toRunifOB2true ()
If UserFormEntry.OptionButton1 = True Then

If UserFormEntry.TextBox1.Value = 51 Then
UserFormCorrection.TextBox1.Value = Range("e51").Value

If UserFormEntry.TextBox1.Value = 52 Then
UserFormCorrection.TextBox1.Value = Range("e52").Value

then, in the click procedure of the button on the entry
userform I test the condition of the other optionbutton
and call the appropriate sub.

This seems to work of but many lines of code are required
to cover all the choices.

Anyone have a suggestion how I can loop this or something
to do this better?

My object names are also very long, can I define them to
something shorter then use the shorter name?

Thanks in advance for your help!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default get cell value to textbox

Hi Christy, perhaps something like...

If UserFormEntry.OptionButton1 = True and
isnumeric(UserFormEntry.TextBox1.Value) Then
UserFormCorrection.TextBox1.Value = Range("E" &
UserFormEntry.TextBox1.Value ).Value
End If
--
Regards,
Rocky McKinley


"Christy" wrote in message
...
Great forum - thanks to all for making it possible

I am trying to use the value a user will type into a
textbox on one userform to determine the value that will
be displayed in a textbox on another userform.

I know the range of numbers the user will type and I have
set up the underlying sheet to have the information I
want to retreive in the row corresponding to that number.
ie: user types 50, the answer I want to disply will be in
row 50.

There are 2 option button also whose choice combination
will determine which column to get the info from.

I have used code like: (this is in it's own module)

Sub toRunifOB2true ()
If UserFormEntry.OptionButton1 = True Then

If UserFormEntry.TextBox1.Value = 51 Then
UserFormCorrection.TextBox1.Value = Range("e51").Value

If UserFormEntry.TextBox1.Value = 52 Then
UserFormCorrection.TextBox1.Value = Range("e52").Value

then, in the click procedure of the button on the entry
userform I test the condition of the other optionbutton
and call the appropriate sub.

This seems to work of but many lines of code are required
to cover all the choices.

Anyone have a suggestion how I can loop this or something
to do this better?

My object names are also very long, can I define them to
something shorter then use the shorter name?

Thanks in advance for your help!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default get cell value to textbox

what a difference, you make it look so easy THANKS!
-----Original Message-----
Dim i as Long
if isnumeric(UserformEntry.Textbox1.Value) then
i = clng(UserFormEntry.TextBox1.Value)
UserFormCorrection.TextBox1.Value = Range("e" &

i).Value
End if

--
Regards,
Tom Ogilvy


Christy wrote in message
...
Great forum - thanks to all for making it possible

I am trying to use the value a user will type into a
textbox on one userform to determine the value that

will
be displayed in a textbox on another userform.

I know the range of numbers the user will type and I

have
set up the underlying sheet to have the information I
want to retreive in the row corresponding to that

number.
ie: user types 50, the answer I want to disply will be

in
row 50.

There are 2 option button also whose choice combination
will determine which column to get the info from.

I have used code like: (this is in it's own module)

Sub toRunifOB2true ()
If UserFormEntry.OptionButton1 = True Then

If UserFormEntry.TextBox1.Value = 51 Then
UserFormCorrection.TextBox1.Value = Range

("e51").Value

If UserFormEntry.TextBox1.Value = 52 Then
UserFormCorrection.TextBox1.Value = Range

("e52").Value

then, in the click procedure of the button on the entry
userform I test the condition of the other optionbutton
and call the appropriate sub.

This seems to work of but many lines of code are

required
to cover all the choices.

Anyone have a suggestion how I can loop this or

something
to do this better?

My object names are also very long, can I define them

to
something shorter then use the shorter name?

Thanks in advance for your help!



.

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
Add Value from Textbox to next cell in range mitch Excel Discussion (Misc queries) 2 February 16th 09 06:36 PM
Calculate Textbox value based on another textbox value.doc Tdungate Excel Discussion (Misc queries) 1 February 12th 09 07:11 PM
Calculate Textbox value based on another textbox value Tdungate Excel Discussion (Misc queries) 0 February 12th 09 07:03 PM
VBA cell to textbox [email protected] Excel Discussion (Misc queries) 3 October 22nd 07 07:47 PM
UserForm TextBox to ActiveSheet TextBox over 256 characters Dan E[_2_] Excel Programming 1 July 28th 03 07:36 PM


All times are GMT +1. The time now is 10:26 PM.

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"