Dependent Multi-Select Drop Down List (VBA)

steveh1873

New Member
Joined
Aug 28, 2014
Messages
17
Hi All,

I have made a drop down list named "Region" (In cells A3:A2500) and a dependent drop down named "Area" (In cells B3:2500), Both are made using named ranges 'Region' and 'CGM', 'HIOW', 'HLNY', 'Merseyside' or 'WY' (depending on 'Region's selection)

I have copied and pasted the following:

Private Sub Worksheet_Change(ByVal Target As Range)
'JBeaucaire 10/2/2009)
'These two macros create a multi-choice dropbox
If Target.Count > 1 Then Exit Sub
Application.EnableEvents = False
If Not Intersect(Target, Range("B:B")) Is Nothing Then
If Target <> "" Then
If Prior <> "" Then Target = Target.Text & ", " & Prior
Prior = Target
Else
Prior = ""
End If
End If
Application.EnableEvents = True
End Sub



Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("B:B")) Is Nothing Then _
Prior = Target.Text
End Sub


It works...to a point... As I'm working through the sheet, I get the following prompt "Run-time error '94': Invalid use of Null" and am directed to the line 'Prior = Target.Text' (highlighted in red.

Can anyone help solve this or provide a new set of code based on the info i've provided?

All help is appreciated...
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

Forum statistics

Threads
1,223,244
Messages
6,170,976
Members
452,372
Latest member
Natalie18

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top