Solved

Option buttons in Excel

Posted on 2014-04-13
3
356 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 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Excel 2016 Not Responding Issues 6 28
Boolean help 6 27
SUMIFS with a criteria that could be in multiple rows 21 35
Excel - find text within text? 1 24
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

896 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now