I use this code to find existing Names in my data worksheet.
Many cells in the data ws are incomplete.
I could use some help with writing this additional code so if/when the Name is selected, I can update the data with another UserForm.
As always, I’m open to suggestions on how to do this better/smarter/faster.
If
ws.Cells(iRow, 4),
ws.Cells(iRow, 5),
ws.Cells(iRow, 7),
ws.Cells(iRow, 8),
ws.Cells(iRow, 9),
ws.Cells(iRow, 10),
ws.Cells(iRow, 12),
are empty…Then,
UserFormUpdate.Show
Else
End If
Code:
Private Sub ComboBox1_AfterUpdate()
Dim iRow As Long
Dim ws As Worksheet
Dim Name As String
Dim CLoc As Range
Set ws = Worksheets("Members")
Name = Me.ComboBox1.Value
Set CLoc = ws.Columns("C:C").Find(What:=Name, after:=ws.Cells(1, 3), LookIn:= _
xlFormulas, LookAt:=xlWhole, SearchOrder:=xlByColumns, SearchDirection:= _
xlNext, MatchCase:=False, SearchFormat:=False)
If CLoc Is Nothing Then
iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row
Else
iRow = CLoc.Row
End If
Do stuff…
Many cells in the data ws are incomplete.
I could use some help with writing this additional code so if/when the Name is selected, I can update the data with another UserForm.
As always, I’m open to suggestions on how to do this better/smarter/faster.
If
ws.Cells(iRow, 4),
ws.Cells(iRow, 5),
ws.Cells(iRow, 7),
ws.Cells(iRow, 8),
ws.Cells(iRow, 9),
ws.Cells(iRow, 10),
ws.Cells(iRow, 12),
are empty…Then,
UserFormUpdate.Show
Else
End If