LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 237
Default Texbox values based on Combobox Value(more detail)

Im sorry but I dont have any code for this so far, however
I do have code at the bottom of this post for when I click
the 3 Option Buttons and ComboBox1 auto-populates with
data from the corresponding columns on Sheet2 Range A2:C52.


I have a userform that contains TextBox1, TextBox2,
TextBox3, OptionButton1, OptionButton2, OptionButton3, and
ComboBox1.

I have a table of data on Sheet2 Range A2:C52.

When I select an option button, it auto-populates
ComboBox1 with the corresponding data in the columns in
Range A2:C52.
OptionButton1 is corresponding with data in columnA,
OptionButton2 is corresponding with data in columnB, and
OptionButton3 is corresponding with data in columnC.

Now, I need a code that will match the value in ComboBox1
with a value in Range A2:C52 on Sheet2. If a match is NOT
found, then do nothing(this will never happen because
anything that is in ComboBox1 will be found in the
range). If there IS a match with the value in ComboBox1
(which there always will be), then I need for the code to
put the corresponding data in the corresponding
TextBoxes. The way it will do this is as follows:

If the match is in a cell in Column A, then I need it to
put the data in that cell in Column A into TextBox1, and
then the corresponding data in the other 2 cells in the
columns into the corresponding 2 Textboxes.

If the match is in a cell in Column B, then I need it to
put the data in that cell in Column B into TextBox2 and
then the corresponding data in the other 2 cells in the
columns into the corresponding 2 Textboxes.

If the match is in a cell in Column C, then I need it to
put the data in that cell in Column C into TextBox3 and
then the corresponding data in the other 2 cells in the
columns into the corresponding 2 Textboxes.

Here is some info that may help...
Below is the code I am using for when I click the 3 Option
Buttons and ComboBox1 auto-populates with data from the
corresponding columns on Sheet2 Range A2:C52...

Private Sub OptionButton1_Click()
cLastRow = Worksheets(2).Cells(Rows.Count, "A").End
(xlUp).Row
With ComboBox1
.Clear
For i = 3 To cLastRow + 1
If Cells(i, "A") < "" Then
.AddItem Worksheets(2).Cells(i -
1, "A").Value
End If
Next i
.ListIndex = 0
End With
End Sub

Private Sub OptionButton2_Click()
cLastRow = Worksheets(2).Cells(Rows.Count, "B").End
(xlUp).Row
With ComboBox1
.Clear
For i = 3 To cLastRow + 1
If Cells(i, "B") < "" Then
.AddItem Worksheets(2).Cells(i -
1, "B").Value
End If
Next i
.ListIndex = 0
End With
End Sub

Private Sub OptionButton3_Click()
cLastRow = Worksheets(2).Cells(Rows.Count, "C").End
(xlUp).Row
With ComboBox1
.Clear
For i = 3 To cLastRow + 1
If Cells(i, "C") < "" Then
.AddItem Worksheets(2).Cells(i -
1, "C").Value
End If
Next i
.ListIndex = 0
End With
End Sub

Thank you

Todd Huttenstine
 
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
use value in texbox to search through worksheet GEORGIA Excel Discussion (Misc queries) 0 March 29th 05 08:15 PM
How do I copy only sub-totalled values - without any detail? Parkperson Excel Worksheet Functions 1 December 16th 04 08:26 PM
Combobox populating based on Option Button Todd Huttenstine[_2_] Excel Programming 7 November 9th 03 10:18 PM
How many CR's in a multi line texbox Mike[_49_] Excel Programming 0 October 26th 03 11:26 PM
ComboBox Values Darren[_3_] Excel Programming 1 July 16th 03 10:41 AM


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

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

About Us

"It's about Microsoft Excel"