Ok or Cancel code

  • Thread starter Thread starter Pat
  • Start date Start date
P

Pat

'Use the Find method to find the Our ref. number on the sales sheet
Set rng = SlsSh.Range("BP1:IV1").Find(InvSh.Range("K23").Value, , , xlWhole)

After the above portion of code runs I want to only allow the code to
continue only if the cell below the cell that is found is empty in Row2. If
it is not empty the message box should give the option to select OK to
continue and overright the existing information or CANCEL to cancel the
code.

Any one know how I can go about this?
Many thanks if you can be of help.
Pat
 
If IsEmpty(rng.Offset(1,0).Value) Then
ans = MsgBox("OK to continue?", vbOKCancel)
if ans = vbCancel Then Exit Sub
End Idf
 
Hi,
That will do nicely, only I need to execute the opposite instruction.
Instead of IsEmpty I need to use the opposite to this. It escapes me to
what that function should be!
 
I have remembered what I should enter.
If Not IsEmpty(rng.Offset(1,0).Value) Then

Cheers
 

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