View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Peter Rooney Peter Rooney is offline
external usenet poster
 
Posts: 325
Default VbYesNo MsgBox won't respond to "No"

Philip,

Doh! It doesn't help if the calling macro deletes the row anyway...

Sorry to waste your time - have a great Christmas! :-)

Pete


"Philip" wrote:

it works fine in Excel 2000 after I declared 'WhereWasI' and commented
'IssuesDataRangeFormat'

put a breakpoint or a stop command in each part of the If statement to watch
the code then try it.

HTH

Philip

"Peter Rooney" wrote:

Apologies to those of you who've already picked this up in the Excel forum.

Can anyone see the deliberate error with this code - no matter what button I
click, it always processes the vbYes option. Response returns "7" when i
click "No" and "6" when I click "Yes".

All help gratefuly received! :-)

Sub ConfirmIssuesDelete()
Dim Prompt, Buttons, Title, Help, Ctxt, Response, MyString

Prompt = "Do you REALLY want to delete this row?" ' Message.
Buttons = vbYesNo + vbCritical + vbDefaultButton1 ' Buttons.
Title = "Whoa!" ' Title.
Help = "D:\DEMO.TXT" ' Define Help file.
Ctxt = 1000 ' Define topic
Response = MsgBox(Prompt, Buttons, Title, Help, Ctxt)
MsgBox (Response)
If Response = vbYes Then
WhereWasI = (Selection.Address)
Selection.EntireRow.Delete
IssuesDataRangeFormat
Range(WhereWasI).Select
Else
Exit Sub
End If
End Sub