+ Reply to Thread
Results 1 to 3 of 3

Thread: Userform option buttoms open relevent sheet

  1. #1
    Registered User
    Join Date
    08-17-2011
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    1

    Arrow Userform option buttoms open relevent sheet

    I have created a user form that looks like the following:

    1. Enter Name....

    2. Enter Telephone Number....

    3. Enter Address.....

    4. Select Department..... (from option buttons)

    - Primary
    - Secondary
    - Accounts
    - Overseas
    - Associations

    The department selection will determine which sheet to open (i.e. primiary sheet opened if primary selected) and enter the rest of the information into the next blank lines in the corresponding colums, i.e. Name in A, Telephone Number in B, Address in C. The userform should work when clicking a commandbutton.

    Is this possiable using the process/layout I have suggested and what would be the correct code to use?

    Thanks for taking the time to read this and any advise you can give

  2. #2
    Valued Forum Contributor Steffen Thomsen's Avatar
    Join Date
    10-15-2010
    Location
    Kolding, Denmark
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    703

    Re: Userform option buttoms open relevent sheet

    Hi,

    You can use an if statement to do what you need

    
    If OptionButton1 = True Then
        Sheets("Primary").Select
    ElseIf OptionButton2 = True Then
        Sheets("Secondary").Select
    ElseIf .OptionButton3 = True Then
        Sheets("Accounts").Select
    ElseIf OptionButton4 = True Then
        Sheets("Overseas").Select
    ElseIf OptionButton4 = True Then
        Sheets("Associations").Select
    Else
         msgBox("No department selected")
    End If

  3. #3
    Forum Moderator Richard Buttrey's Avatar
    Join Date
    02-15-2008
    Location
    Grappenhall, UK
    MS-Off Ver
    Excel for Windows & Mac - all versions.
    Posts
    6,566

    Re: Userform option buttoms open relevent sheet

    Hi,

    ... or if the option buttons are the last item to be actioned on the form just put Steffen's select code in the Option button click event and an Unload Me instruction.

    Regards
    Richard Buttrey

    If this was useful then please rate it appropriately.

    Click the small star icon at the bottom left of my post.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.2.0