Dependent Dropdown (VBA)

Robby19

Board Regular
Joined
Mar 19, 2018
Messages
227
Good day!

Looking for some help in creating a dependent dropdown (combo box) on a User from. The Named Ranges are being pulled from tables.

Basically it needs to run like this;

If ExpIncDrop (Combo box) = "Expense"
Then TypeDrop (Combo box) = ExpenseType (Defined Named Range)
Else TypeDrop (Combo box) = IncomeType (Defined Named Range)

ExpenseType and IncomeType is a defined named range both in separate tables.
 
Last edited:

Some videos you may like

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

Yongle

Well-known Member
Joined
Mar 11, 2015
Messages
6,788
Office Version
  1. 365
Platform
  1. Windows
Try this

Code:
Private Sub TypeDrop_DropButt*******()
    Dim Rng As Range
    Set Rng = Range("Income")
    If ExpIncDrop.Value = "Expense" Then Set Rng = Range("Expense")
    TypeDrop.List = Application.WorksheetFunction.Transpose(Rng)
End Sub
 
Last edited:

Yongle

Well-known Member
Joined
Mar 11, 2015
Messages
6,788
Office Version
  1. 365
Platform
  1. Windows
How strange - I can see asterisks in the post above :confused:
- tried several times and it refuses to display correctly in the post window

Remove the space between Button and Click below !!

Code:
Private Sub TypeDrop_Drop[COLOR=#ff0000]Button[/COLOR] [COLOR=#ff0000]Click[/COLOR]()
    Dim Rng As Range
    Set Rng = Range("Income")
    If ExpIncDrop.Value = "Expense" Then Set Rng = Range("Expense")
    TypeDrop.List = Application.WorksheetFunction.Transpose(Rng)
End Sub
 
Last edited:

Robby19

Board Regular
Joined
Mar 19, 2018
Messages
227
Haha. I see the asterisks too. I was going through each and every selection to figure it out. Thank you! It works!!
 

Watch MrExcel Video

Forum statistics

Threads
1,109,533
Messages
5,529,404
Members
409,871
Latest member
i1patrick
Top