Excel 2003 + macro

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.
 
M

Mike H

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.
 
L

Luke M

If Range("D34").Value = "No" then
MsgBox "Your printer code doesn't match"
Exit Sub
End If
 
J

Jacob Skaria

If UCase(Range("D34")) = "NO" Then
MsgBox "Your printer code doesnt match": Exit Sub
End If

'Rest of your macro
 
B

Bernard Liengme

Sub Somename()
If UCASE(Range("D4")) = "NO" Then
msgbox "Printer mismatch"
Exit Sub
End If

existing code
End Sub

best wishes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top