Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Pat Pat is offline
external usenet poster
 
Posts: 122
Default Ok or Cancel code

'Use the Find method to find the Our ref. number on the sales sheet
Set rng = SlsSh.Range("BP1:IV1").Find(InvSh.Range("K23").Val ue, , , 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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default Ok or Cancel code

If IsEmpty(rng.Offset(1,0).Value) Then
ans = MsgBox("OK to continue?", vbOKCancel)
if ans = vbCancel Then Exit Sub
End Idf

--
HTH

-------

Bob Phillips
"Pat" wrote in message
...
'Use the Find method to find the Our ref. number on the sales sheet
Set rng = SlsSh.Range("BP1:IV1").Find(InvSh.Range("K23").Val ue, , ,

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




  #3   Report Post  
Posted to microsoft.public.excel.programming
Pat Pat is offline
external usenet poster
 
Posts: 122
Default Ok or Cancel code

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!


"Bob Phillips" wrote in message
...
If IsEmpty(rng.Offset(1,0).Value) Then
ans = MsgBox("OK to continue?", vbOKCancel)
if ans = vbCancel Then Exit Sub
End Idf

--
HTH

-------

Bob Phillips
"Pat" wrote in message
...
'Use the Find method to find the Our ref. number on the sales sheet
Set rng = SlsSh.Range("BP1:IV1").Find(InvSh.Range("K23").Val ue, , ,

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






  #4   Report Post  
Posted to microsoft.public.excel.programming
Pat Pat is offline
external usenet poster
 
Posts: 122
Default Ok or Cancel code

I have remembered what I should enter.
If Not IsEmpty(rng.Offset(1,0).Value) Then

Cheers

"Pat" wrote in message
...
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!


"Bob Phillips" wrote in message
...
If IsEmpty(rng.Offset(1,0).Value) Then
ans = MsgBox("OK to continue?", vbOKCancel)
if ans = vbCancel Then Exit Sub
End Idf

--
HTH

-------

Bob Phillips
"Pat" wrote in message
...
'Use the Find method to find the Our ref. number on the sales sheet
Set rng = SlsSh.Range("BP1:IV1").Find(InvSh.Range("K23").Val ue, , ,

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








Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Workbook_BeforeClose(Cancel As Boolean) - Cancel won't work gpmichal Setting up and Configuration of Excel 1 May 12th 09 02:33 AM
Exit Code Upon Cancel On Type 8 Input Box FARAZ QURESHI Excel Discussion (Misc queries) 2 March 31st 08 09:22 AM
Save - Yes / No / Cancel Jon Peltier Excel Discussion (Misc queries) 9 May 7th 06 02:03 AM
Use code to cancel printing Jim [email protected] Excel Programming 1 October 30th 03 10:05 PM
MSForms cancel Tritan Excel Programming 1 July 17th 03 08:50 PM


All times are GMT +1. The time now is 02:02 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"