Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / February 2006

Tip: Looking for answers? Try searching our database.

MsgBox, VBYes, VBNo

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Richard - 18 Feb 2006 17:06 GMT
Help with creationg a MsgBox with VBYes and VBNo, then putting a 1 or 0 in
Sheet4, cell C4. Probably putting the code in Workbook Open?
Example:If date is =>July1 and <July 5 then Msgbox "Do you qualify for Bank
Day? If VBYes is selected then a 1 is sent to Sheet4 cell C4, If VBNo then a
0 is sent to Sheet4 cell C4. I just can't write the code correctly.
Thanks in advance
Steve Yandl - 18 Feb 2006 17:25 GMT
You can try this for the MsgBox portion.

intResp = MsgBox("Do you qualify for Bank Day?", vbYesNo)
If intResp = 6 Then  '  Yes was clicked
Sheets(4).Cells(4, 3).Value = 1
End If
If intResp = 7 Then  '  No was clicked
Sheets(4).Cells(4, 3).Value = 0
End If

Steve Yandl

> Help with creationg a MsgBox with VBYes and VBNo, then putting a 1 or 0 in
> Sheet4, cell C4. Probably putting the code in Workbook Open?
[quoted text clipped - 4 lines]
> 0 is sent to Sheet4 cell C4. I just can't write the code correctly.
> Thanks in advance
Bob Phillips - 18 Feb 2006 17:28 GMT
Private Sub Workbook_Open()
Dim ans
   If Month(Date) = 7 Then
       If Day(Date) >= 1 And Day(Date) < 5 Then
           If MsgBox("Do you qualify for Bank Day?", _
               vbYesNo) = vbYes Then
               Worksheets("Sheet4").Range("C4").Value = 1
           Else
               Worksheets("Sheet4").Range("C4").Value = 0
           End If
       End If
   End If
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code

Signature

HTH

Bob Phillips

(remove nothere from email address if mailing direct)

> Help with creationg a MsgBox with VBYes and VBNo, then putting a 1 or 0 in
> Sheet4, cell C4. Probably putting the code in Workbook Open?
>  Example:If date is =>July1 and <July 5 then Msgbox "Do you qualify for Bank
> Day? If VBYes is selected then a 1 is sent to Sheet4 cell C4, If VBNo then a
> 0 is sent to Sheet4 cell C4. I just can't write the code correctly.
> Thanks in advance
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.