dpaton05
Well-known Member
- Joined
- Aug 14, 2018
- Messages
- 2,392
- Office Version
- 365
- 2016
- Platform
- Windows
I need to add a check if the young person I am trying to add to the list is already in the list and if they are, not to add them. Maybe a message box saying they are already in the list.
This is my code to add a young person.
What would I add to check if they are already in the range on the sheet YP?
This is my code to add a young person.
VBA Code:
Sub AddYP()
Application.DisplayAlerts = False
Dim newyp As String
newyp = Tracker.Cells(6, 4)
YP.Range("A" & Rows.Count).End(xlUp).Offset(1, 0) = newyp
Call CreateWB(newyp)
ThisWorkbook.Names.Add Name:="tblYPNames", _
RefersTo:=Range("tblYPNames").Resize(Range("tblYPNames").Rows.Count + 1)
Tracker.cboYP.ListFillRange = "tblYPNames"
Tracker.cboYP.ListFillRange = "tblYPNames"
Application.DisplayAlerts = True
End Sub
What would I add to check if they are already in the range on the sheet YP?