![]() |
I need major help fast!!!!!
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?:confused: -- 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 |
I need major help fast!!!!!
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?:confused: -- 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 |
I need major help fast!!!!!
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 |
I need major help fast!!!!!
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 |
All times are GMT +1. The time now is 05:17 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com