Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Option buttons in Excel

Posted on 2014-04-13
3
Medium Priority
?
383 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
3 Comments
 
LVL 28

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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

824 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