Run macro only if
Hi,
Is this what you mean
Sub somemacro()
Set sht = Sheets("Sheet1") ' change to suit
With sht
If UCase(.Range("A1")) < "JOHN" _
Or UCase(.Range("C1")) < "MARI" _
Or .Range("D1") < "" Then
MsgBox "Criteria not met"
Exit Sub
End If
End With
'Your code
End Sub
--
Mike
When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.
"puiuluipui" wrote:
Hi, i need a macro to run if A1 contains "John" and C1 contains "Mari", and
if D1 is blank. If this criteria is not mached, then the macro to display a
message.
Can this be done?
Thanks!
|