I am looping through a named range (Log) to see if the cell value matches a variable that I enter an inputbox and then if an offset cell matches another variable that I enter in a second inputbox.
My problem is that even if the matches are found the Msgbox still pops up and I exit the sub. I want that to be the case if no match is found.
I have looked through posts and pages for two days now
PLEASE HELP!!!!!
Code below:
I'm sure it is something simple that I just don't know about.
Thank you for any help,
DaBeard
My problem is that even if the matches are found the Msgbox still pops up and I exit the sub. I want that to be the case if no match is found.
I have looked through posts and pages for two days now

Code below:
Code:
Sub mtch()
Dim c As Range
Dim myVar1 As String
Dim myVar2 As String
'Set CSN of copied row as first variable
myVar1 = InputBox("Enter CSN Number of copied row")
'Set Req Line # of copied row as second variable
myVar2 = InputBox("Enter Req Line # of copied row")
'Searches through the range "Log" for the first variable and then checks to see if second variable matches, if TRUE selects the cell in Log
For Each c In Range("Log")
If c.Value = myVar1 And c.Offset(0, 26).Value = myVar2 Then
Application.Goto c, True
Exit For
End If
Next c
MsgBox "Incorrect CSN or Req Line # entered. Please try again."
Exit Sub
I'm sure it is something simple that I just don't know about.
Thank you for any help,
DaBeard