Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Option buttons in Excel

Posted on 2014-04-13
3
Medium Priority
?
381 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 1000 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 1000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

721 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