LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default User Form: Combo Box - filter out repeats.

Hi,

My code thus far is:-

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)
LoadEditors
LoadTitles
End Sub
Private Sub LoadEditors()
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 LoadTitles()
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, 3)
If Not markets.Exists(market) Then
markets.Add market, market
TitleSelect.AddItem market
End If
Next

End Sub
Private Sub Editors_Change()
LoadTitlesData
End Sub
Private Sub LoadTitlesData()
Dim markets As New Scripting.Dictionary
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

Private Sub TitleSelect_Change()
LoadMarketData
End Sub

Private Sub LoadMarketData()

Dim index As Long
Dim titleselection As String


titleselection = TitleSelect.Value
With Titles
.Clear
For index = 2 To Source.Rows.Count
If Source.Cells(index, 3).Value = titleselection Then
.AddItem Source.Cells(index, 4)
.List(.ListCount - 1, 1) = Source.Cells(index, 5)
.List(.ListCount - 1, 2) = Source.Cells(index, 6)
.List(.ListCount - 1, 3) = Source.Cells(index, 7)
.List(.ListCount - 1, 4) = Source.Cells(index, 8)
.List(.ListCount - 1, 5) = Source.Cells(index, 10)
.List(.ListCount - 1, 6) = Source.Cells(index, 11)
.List(.ListCount - 1, 7) = Source.Cells(index, 12)
.List(.ListCount - 1, 8) = Source.Cells(index, 13)

End If
Next
End With
End Sub


What I would like in the LoadTitlesData Sub something that clears and
repeated / duplicate title names. As the LoadTitles Sub works?

Could someone help me please?

TIA
Matthew

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Combo Box on User Form Question James Excel Programming 1 July 26th 06 03:02 AM
combo box in a user form juliejg1 Excel Programming 3 April 10th 06 09:15 PM
Can't seem to get Combo Box on User Form [email protected] Excel Programming 5 April 25th 05 11:15 AM
Patrick -- 424 Combo Box User Form Jennifer Excel Programming 2 April 8th 05 07:31 AM
Run Time Error 424 Combo Box User Form Jennifer Excel Programming 3 April 7th 05 08:23 PM


All times are GMT +1. The time now is 02:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"