ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   User Form Help (https://www.excelbanter.com/excel-programming/376036-user-form-help.html)

Matthew Balch[_2_]

User Form Help
 
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



All times are GMT +1. The time now is 09:21 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com