Excel 2003 + macro

  • Thread starter Thread starter Neil Holden
  • Start date Start date
N

Neil Holden

I want to place some code at the start of my macro.

If D34 = no then a message box "Your printer code doesnt match" end macro
else yes run the macro.

Please help.
 
Hi,

Like this

Set sht = Sheets("Sheet1")
If UCase(sht.Range("D34")) = "NO" Then
MsgBox ("Your printer code doesn't match")
Exit Sub
End If

'Yuor code
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.
 
If Range("D34").Value = "No" then
MsgBox "Your printer code doesn't match"
Exit Sub
End If
 
If UCase(Range("D34")) = "NO" Then
MsgBox "Your printer code doesnt match": Exit Sub
End If

'Rest of your macro
 
Sub Somename()
If UCASE(Range("D4")) = "NO" Then
msgbox "Printer mismatch"
Exit Sub
End If

existing code
End Sub

best wishes
 
Back
Top