If Then macro needed

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a situation where I need to insert a line of code into a macro I have,
but I need some help.

I need to have the macro present a message to the user if any number is
present in a particular cell.

So basically this: If cell a7 contains "any number" then message box "this
cell contains QTY"...

thanks in advance for the assistance.
 
try:

If IsNumeric(Range("A7")) And Range("A7") <> "" Then
MsgBox "This cell contains QTY " & Range("A7")
End If
 
Perfect, almost.... Is there are way to make it so when this does happen,
the macro will stop where the situation occured?
 
If IsNumeric(Range("A7")) And Range("A7") <> "" Then
MsgBox "This cell contains QTY " & Range("A7")
Exit sub ' (or END)
End If
 

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

Back
Top