Solved

Option buttons in Excel

Posted on 2014-04-13
3
374 Views
Last Modified: 2014-04-13
Folks,
I have three option buttons on the form below. When the user click on "Selected Worksheet" they need to go to the worksheet selected. My option buttons are optOne, optTwo, optThree.
The option buttons came from the Tools for the form when I inserted a UserForm. I plan on incorporating a message box to affirm that what the user select was what they wanted.
I've named the command button "cmdWorksheet"
Program optin buttons
0
Comment
Question by:Frank Freese
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 27

Assisted Solution

by:MacroShadow
MacroShadow earned 250 total points
ID: 39997690
Private Sub cmdWorksheet_Click
    Dim strSheetName as String
    Select Case Me.OptionGroup
        Case Is = "optOne"
            strSheetName = "Expected Delivery Date"
        Case Is = "optTwo"
            strSheetName = "Vaccines"
        Case Is = "optThree"
            strSheetName = "Filters"
    End Select
    Worksheets(strSheetName).Activate
End Sub
0
 
LVL 59

Accepted Solution

by:
Saurabh Singh Teotia earned 250 total points
ID: 39997695
I believe this is what you are looking for... Choose the sheet name with your sheet names also choose what optionbutton name you have defined...

Private Sub cmdWorksheet_Click()
    Dim resp As String
    If OptionButton1.Value = True Then
        resp = MsgBox("Do you want to select Sheet1?", vbYesNo)

        If resp = vbYes Then
            Sheets("Sheet1").Select
        Else
            MsgBox "Option Canceled"
        End If
    End If

    If OptionButton2.Value = True Then
        resp = MsgBox("Do you want to select Sheet2?", vbYesNo)

        If resp = vbYes Then
            Sheets("Sheet2").Select
        Else
            MsgBox "Option Canceled"
        End If
    End If


    If OptionButton3.Value = True Then
        resp = MsgBox("Do you want to select Sheet3?", vbYesNo)

        If resp = vbYes Then
            Sheets("Sheet3").Select
        Else
            MsgBox "Option Canceled"
        End If
    End If


End Sub

Open in new window


Saurabh...
0
 

Author Closing Comment

by:Frank Freese
ID: 39997700
Fantastic - thank you both very much
I do appreciate all that the Experts do in helping me!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question