MrExcel Publishing
Your One Stop for Excel Tips & Solutions

creating interactive button functions


Posted by HDC on July 16, 2001 8:56 AM

I have two sets of data that I want to be able to display based on the user's response to a "yes-no" option button.
How do I build that "yes-no" option button and link the answers to the appropriate data table?


Posted by Cory on July 16, 2001 10:08 AM

Is this what you want?: You have two sheets (data tables) each with its own data. Upon clicking a button the user's asked whether or not they want to see one of them. If they choose "yes" then show them one sheet, but if they choose "no" then show them the other sheet...

If this's the case then try the following code in a command button's event handler:

Private Sub CommandButton1_Click()
Response = MsgBox("View the data?", vbYesNo, "Data")
If Response = vbNo Then
(Code to view 1st sheet here)
Else
(Code to view 2nd sheet here)
End If
End Sub

Help any?
Cory