View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
John John is offline
external usenet poster
 
Posts: 2,069
Default Message Box - Yes/No

another approach you may want to consider:

Sub ClearDoc()
Dim ClearRange As Range

With Worksheets("Input")

.Activate

Set ClearRange = .Range("A6:H35")

.Range("A6").Select

End With

answer = MsgBox("Do you have another Agency Billing to complete ?", _
36, "Agency Billing")

If answer = 6 Then

Application.EnableEvents = False

ClearRange.ClearContents

Application.EnableEvents = True

Else

msg = MsgBox("Costs have been recorded. This file will now close", _
64, "Agency Billing")

ThisWorkbook.Close SaveChanges:=False

End If

End Sub

--
jb


"mathel" wrote:

Hi, I am running Excel 2003 and have created a Mssg Box for a workbook that
requires a Yes / No response. For some reason, the 'Yes' response needs to
be 'double clicked' to activiate it. Can someone tell me how, or if it can
be changed to 'single click'. The code I have is:

Sub ClearDoc()

Dim response As Long
answer = MsgBox("Do you have another Agency Billing to complete ?",
vbYesNo + vbQuestion)

If answer = vbYes Then

Sheets("Input").Select
Range("A6:h35").Select
Selection.ClearContents
Range("A6").Select

Else

Sheets("Input").Select
Range("A6").Select

MsgBox "Costs have been recorded. This file will now close", vbInformation

Application.ScreenUpdating = True
ActiveWorkbook.Close SaveChanges:=False

End If
End Sub

Thanks
--
Linda