User Form Help

M

Matthew Balch

Hi,

I have this code thus far, which Ive copied pretty much.

-----------------

Option Explicit
Private Const Sourcename As String = "SubsTargets"
Private Source As Range



Private Sub cmdClose_Click()
Unload Me
End Sub

Private Sub Label2_Click()

End Sub

Private Sub Titles_Click()

End Sub

Private Sub UserForm_Click()

End Sub

Private Sub UserForm_Initialize()
Set Source = Range(Sourcename)
LoadMarkets
End Sub
Private Sub LoadMarkets()
Dim markets As New Scripting.Dictionary
Dim index As Long
Dim market As String
For index = 2 To Source.Rows.Count
market = Source.Cells(index, 1)
If Not markets.Exists(market) Then
markets.Add market, market
Editors.AddItem market
End If
Next


End Sub
Private Sub Editors_Change()
LoadMarketData
LoadTitlesData
End Sub
Private Sub LoadMarketData()
Dim market As String
Dim index As Long
Dim titleselection As String

market = Editors.Value
titleselection = TitleSelect.Value
With Titles
.Clear
For index = 2 To Source.Rows.Count
If Source.Cells(index, 1).Value = market Then
.AddItem Source.Cells(index, 2)
.List(.ListCount - 1, 1) = Source.Cells(index, 3)
.List(.ListCount - 1, 2) = Source.Cells(index, 4)

End If
Next
End With

End Sub
Private Sub LoadTitlesData()
Dim market As String
Dim index As Long

market = Editors.Value
With TitleSelect
.Clear
For index = 2 To Source.Rows.Count
If Source.Cells(index, 1).Value = market Then
.AddItem Source.Cells(index, 3)
End If
Next
End With

End Sub

------------------------

My first drop down being the Editors.
The second down being Load TitlesData.
The listbox being loadmarketdata.

How do I alter the code in the loadmarketdata routine so that it depends on
both the Editor selection (already done) but then on the title select???

TIA

Matthew
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top