ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   User Form (https://www.excelbanter.com/excel-programming/336222-user-form.html)

Discovery

User Form
 

I have set up a user form which has command buttons to open various
worksheets in my workbook. However, I want each worksheet to have a
button to take the user back to the user form; is there a way I could
do this?

Many thanks,
Discovery


--
Discovery
------------------------------------------------------------------------
Discovery's Profile: http://www.excelforum.com/member.php...o&userid=25859
View this thread: http://www.excelforum.com/showthread...hreadid=392433


K Dales[_2_]

User Form
 
Sure. All you need for code is
UserForm1.Show
(or whatever the name of your form is)

I would also suggest to you that it might be worth putting a button to do
this on the toolbar (CommandBarButton object): This way one button serves all
sheets, and the buttons will not take up space on your worksheets.
--
- K Dales


"Discovery" wrote:


I have set up a user form which has command buttons to open various
worksheets in my workbook. However, I want each worksheet to have a
button to take the user back to the user form; is there a way I could
do this?

Many thanks,
Discovery


--
Discovery
------------------------------------------------------------------------
Discovery's Profile: http://www.excelforum.com/member.php...o&userid=25859
View this thread: http://www.excelforum.com/showthread...hreadid=392433



Discovery[_2_]

User Form
 

But how can I put the code in the worksheet?

Thanks,
Discovery


--
Discovery
------------------------------------------------------------------------
Discovery's Profile: http://www.excelforum.com/member.php...o&userid=25859
View this thread: http://www.excelforum.com/showthread...hreadid=392433


Discovery[_3_]

User Form
 

But how can I put the code in the worksheet?

Thanks,
Discovery


--
Discovery
------------------------------------------------------------------------
Discovery's Profile: http://www.excelforum.com/member.php...o&userid=25859
View this thread: http://www.excelforum.com/showthread...hreadid=392433


K Dales[_2_]

User Form
 
The easy way is to put a commandbutton from the Forms toolbar onto every
sheet where you would like it to function. When it asks you to specify the
macro choose "New..." and you can type the code in the button's _Click
procedure.

The other method, using a single toolbar button, is to insert a module and
add the code in a Public Sub, e.g:
Public Sub ShowMyForm()
UserForm1.Show
End Sub

Then right-click somewhere on your toolbar. Choose "Customize" and in the
dialog go to the tab that says "Commands." If you choose Macros in the
Categories List you will see on the right an option for "Custom Button"
(smiley face). Drag the smiley onto your toolbar, then (with the Customize
dialog still showing) right-click the smiley and choose "Assign Macro..." -
here you should be able to see your ShowMyForm macro in the list, so assign
it to the button. Then whenever the user presses that button the UserForm
should show allowing the selection of another sheet. You can customize this
option even further but this should be enough to at least get you going, I
hope.
--
- K Dales


"Discovery" wrote:


But how can I put the code in the worksheet?

Thanks,
Discovery


--
Discovery
------------------------------------------------------------------------
Discovery's Profile: http://www.excelforum.com/member.php...o&userid=25859
View this thread: http://www.excelforum.com/showthread...hreadid=392433



Discovery[_4_]

User Form
 

Thank you ever so much for your help. I will definately try that out.
I think the first method sounds easiest!

Discovery


--
Discovery
------------------------------------------------------------------------
Discovery's Profile: http://www.excelforum.com/member.php...o&userid=25859
View this thread: http://www.excelforum.com/showthread...hreadid=392433



All times are GMT +1. The time now is 12:02 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com