I can't seem to get my else statement to work. Basically if the value of cellRef is Null i want a pop up message, any suggestions why this is not working? Many Thanks in advance!
Code:
Private Sub displaybtn_Click()
Dim ni_num As String
Dim ni_num_missing_one As String
ni_num = TextBox1.Value & TextBox2.Value & TextBox3.Value & TextBox4.Value & TextBox5.Value
ni_num_missing_one = TextBox1.Value & TextBox2.Value & TextBox3.Value & TextBox4.Value & " "
cellRef = Cells.Find(ni_num, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False).Address
If IsNull(cellRef) Then
cellRef = Cells.Find(ni_num_missing_one, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False).Address
End If
If Not IsNull(cellRef) Then
Range(cellRef).Activate
Me.Resultbox = ActiveCell.Offset(0, -1).Value
Else
MsgBox "Not Found"
End If