Event Procedure for Multiple User Forms in Multiple Worksheets VBA

wcm69

Board Regular
Joined
Dec 25, 2016
Messages
112
I have created a workbook which lists Products and their Suppliers. The workbook contains 51 worksheets (plus a contents page)

I have categorised each Product into Product Ranges - of which their are 17.
For ease of use, each of the 17 Product Ranges are on 3 worksheet tabs, hence 51 worksheets.

I now have 17 User Forms which are named in accordance with the (Product Range) tab names.

What I want is for each of the 17 User Forms to be assigned or set, (i.e. active / visible) to 3 'Product Range Worksheets'. Whilst one User Form is active, the other 16 User Forms are to stay invisible / non-active until their particular 3 worksheets are open / activated.
I am using the User Forms with Command Buttons to navigate through the workbook as there are so many worksheets.

Having very limited knowledge in VBA I'm hoping the above is clear and someone can provide a code/s (with a few instruction) that will do the trick.

Thanks in advance :smile:
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Your probable going to have to Right click on all 51 sheets and enter some code like this:

Bob being the name of the UserForm you want to open when you activate your sheet.

Code:
Private Sub Worksheet_Activate()
Bob.Show modeless
End Sub
Private Sub Worksheet_Deactivate()
Bob.Hide
End Sub
 
Upvote 0
17 userforms?

Are they all different? ie different controls, layout etc
 
Upvote 0
Hi Norie,

Thanks for the reply.

All 17 User Forms are different. I want each User Form to be used on 3 Worksheets to navigate through the workbook. (I have a total of 51 worksheets)

Currently when I use the codes provided, the specified User Form opens in the correct worksheet, but it also opens the same User Form in all the other sheets in my workbook as well?

I need when I click on the sheet tab to go to another page the correct User Form becomes visible and the previous or non required User Form/s become invisible or de-activate.

If you can provide any help I'd be grateful.

Thanks to all in advance :)
 
Upvote 0
What code do you currently have?

Is there a way to associate a particular userform with a particular worksheet(s), eg by name?
 
Upvote 0

Forum statistics

Threads
1,225,008
Messages
6,182,331
Members
453,105
Latest member
Dentine

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top