Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() Hello Everyone, I am new to this post. I am stumped and figured I would ask the gurus. I am using VBA Excel to create a UserForm that will allow the user to select a value from ComboBox1 and another Value from Combobox2 and based on the two selections Textbox3 is populated with a message that I define. For Example: If the user choose China from Combox1 and USA from Combobox2 Then the result display in Textbox3 would be "you will pay taxes here after 184 days" The problem is in column A and B of the spreadsheet I have 146 countries ( the fill for combo boxes 1&2), so to use an If..Than...Else statement would be extremely labor intensive. Could anyone help? ![]() -- Mr. Jay ------------------------------------------------------------------------ Mr. Jay's Profile: http://www.excelforum.com/member.php...o&userid=32350 View this thread: http://www.excelforum.com/showthread...hreadid=521070 |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Maybe you can build a table.
Put the combobox1 values down column A and the combobox2 values across row 1. Then you can use =index(match()) to retrieve the value. You may want to read Debra Dalgleish's notes: http://www.contextures.com/xlFunctions03.html Look at examples 2 & 3. "Mr. Jay" wrote: Hello Everyone, I am new to this post. I am stumped and figured I would ask the gurus. I am using VBA Excel to create a UserForm that will allow the user to select a value from ComboBox1 and another Value from Combobox2 and based on the two selections Textbox3 is populated with a message that I define. For Example: If the user choose China from Combox1 and USA from Combobox2 Then the result display in Textbox3 would be "you will pay taxes here after 184 days" The problem is in column A and B of the spreadsheet I have 146 countries ( the fill for combo boxes 1&2), so to use an If..Than...Else statement would be extremely labor intensive. Could anyone help? ![]() -- Mr. Jay ------------------------------------------------------------------------ Mr. Jay's Profile: http://www.excelforum.com/member.php...o&userid=32350 View this thread: http://www.excelforum.com/showthread...hreadid=521070 -- Dave Peterson |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() Could you give please give me a little more detail as to how this might work using VBA. I could set up my spreadsheet like you described. -- Mr. Jay ------------------------------------------------------------------------ Mr. Jay's Profile: http://www.excelforum.com/member.php...o&userid=32350 View this thread: http://www.excelforum.com/showthread...hreadid=521070 |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Option Explicit
Private Sub CommandButton1_Click() Dim myRow As Variant Dim myCol As Variant Dim myRng As Range Dim myVal As Variant Set myRng = Worksheets("sheet99").Range("a1:x33") 'whatever you use here myRow = Application.Match(ComboBox1.Value, myRng.Columns(1), 0) myCol = Application.Match(ComboBox2.Value, myRng.Rows(1), 0) If IsNumeric(myRow) _ And IsNumeric(myCol) Then myVal = myRng.Cells(myRow, myCol).Value Else myVal = "Missing" End If MsgBox myVal End Sub "Mr. Jay" wrote: Could you give please give me a little more detail as to how this might work using VBA. I could set up my spreadsheet like you described. -- Mr. Jay ------------------------------------------------------------------------ Mr. Jay's Profile: http://www.excelforum.com/member.php...o&userid=32350 View this thread: http://www.excelforum.com/showthread...hreadid=521070 -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
searches slow on some computers fast on others? | Excel Discussion (Misc queries) | |||
Searches slow for some Fast for others? | Excel Worksheet Functions | |||
how do I set up a fast comparison table? | Excel Discussion (Misc queries) | |||
Fast Fourier Transform | Excel Worksheet Functions | |||
IS THERE A FAST WAY TO CHANGE THE ORDERS OF CONDITIONAL FORMATTIN. | Excel Discussion (Misc queries) |