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![]()
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
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 iconat the bottom left of my post.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks