Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
It doesn't work because the only thing the msgbox can return is vbOK and he
is checking for vbYes MsgBox("Click to View Data", vbOKOnly) = vbYes But if the user can only return vbOK, then why even bother to check MsgBox "Click to View Data", vbOKOnly Sheets("Sheet1").Visible = True Sheets("Sheet1").Activate Sheets("Sheet3").Visible = False Would function the same. Regards, Tom Ogilvy "Tim" wrote in message ... Ed, Try replacing the code that starts with, "If MsgBox" with this: Dim Ans As Integer Ans = MsgBox("Click to View Data", vbOKOnly) If Ans = 1 Then Sheets("Sheet1").Visible = True Sheets("Sheet1").Activate Sheets("Sheet3").Visible = False End If I don't know why your code doesn't work (it wouldn't for me either). Someone brighter than I can probably answer off the top of their head. Tim "Ed" wrote in message ... I have the following code: Private Sub Workbook_Open() If ActiveWorkbook.ReadOnly = False Then ThisWorkbook.Saved = True ThisWorkbook.ChangeFileAccess xlReadOnly End If Worksheets("Sheet1").Visible = xlVeryHidden Worksheets("TIRs").Visible = xlVeryHidden If MsgBox("Click to View Data", vbOKOnly) = vbYes Then Sheets("Sheet1").Visible = True Sheets("Sheet1").Activate Sheets("Sheet3").Visible = False End If End Sub The message box pops up, but nothing happens when I click the Yes button on the message box. What did I do wrong? Ed |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
"Tom Ogilvy" wrote in message
... It doesn't work because the only thing the msgbox can return is vbOK and he is checking for vbYes MsgBox("Click to View Data", vbOKOnly) = vbYes Thanks, Tom. Maybe I ought to leave off learning programming for a while and figure out how to proof-read!! *sigh* Ed |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Bring Back DBF! The GIS Industry uses it! | Excel Discussion (Misc queries) | |||
Bring back .dbf in Excel | Excel Discussion (Misc queries) | |||
Bring Back Qualified Sum from another WB | Excel Worksheet Functions | |||
Bring back the old help format! | Excel Worksheet Functions | |||
Stuck myself - can't bring back "VeryHidden" | Excel Programming |