Command Buttons on Userform

PaulWJ

New Member
Joined
Dec 4, 2023
Messages
12
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I have a multipage Userform which has 9 tabs at the top. The tabs are selected based on a number of options (they prompt a user to ask specific questions based on different scenarios). Essentially, however, they all do the same thing - check the questions have been answered correctly.

I can add Command Buttons on each (Confirm, Cancel, Clear & Other), but each needs it's own private sub, which runs on the 'click' of each button. I've done one tab, but is here any way to replicate the code on the buttons on the other tabs (rather than having the same four bits of code replicated 9 times?
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Is it basically the same code (or logic) for every page?
 
Upvote 0
Yes Rory, it is.

JK - honestly, because I didn't know I could do that :) First stab at a multipage userform and still finding my way round. I'll give that a go.
 
Upvote 0
Paul: You can use the Value property of the multipage to get the page number (zero indexed) and have the buttons act accordingly..
 
Upvote 0
Thanks both. I will have a play and see what I can do. If I need more help, I'll be back.
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,953
Members
449,095
Latest member
nmaske

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