Hi, nashle6,
you are the one to work with the form or distribute the workbook, I can just explain how I would like things to be set up (which doesnīt mean that it should be solved in that way).
Code for NewScoreModifier without commands Clear and Modify:
Option Explicit
Private Sub ColourDrop_Change()
Dim lngCounter As Long
Dim lngCol As Long
Dim lngTB As Long
EntrantCB.Clear
For lngCol = 1 To 3
Controls("txtBox" & lngCol).Value = vbNullString
Next lngCol
With Sheets("Scores")
For lngCounter = 2 To .Cells(Rows.Count, "B").End(xlUp).Row
If UCase(.Cells(lngCounter, "B").Value) = UCase(ColourDrop.Value) Then
lngTB = lngTB + 1
EntrantCB.AddItem .Cells(lngCounter, "A").Value
End If
Next lngCounter
End With
End Sub
Private Sub EntrantCB_Change()
Dim lngCol As Long
Dim rngFound As Range
With Sheets("Scores")
Set rngFound = .Range("A:A").Find(what:=EntrantCB.Value)
If Not rngFound Is Nothing Then
For lngCol = 1 To 3
Controls("txtBox" & lngCol).Value = .Cells(rngFound.Row, 2 + lngCol).Value
Next lngCol
End If
Set rngFound = Nothing
End With
End Sub
Private Sub UserForm_Initialize()
Dim wbBook As Workbook
Dim wsSheet As Worksheet
Dim rnData As Range
Dim rngCell As Range
Set wbBook = ThisWorkbook
Set wsSheet = wbBook.Worksheets("Scores")
With wsSheet
Set rnData = .Range(.Range("B2"), .Range("B" & Rows.Count).End(xlUp))
End With
With Me.ColourDrop
.Clear
For Each rngCell In rnData
If WorksheetFunction.CountIf(wsSheet.Range("B2:B" & rngCell.Row), rngCell) = 1 Then
.AddItem rngCell
End If
Next rngCell
.ListIndex = -1
End With
End Sub
Ciao,
Holger
Bookmarks