3 different command buttons on worksheet to call userform but to change label as well.

danbates

Active Member
Joined
Oct 8, 2017
Messages
357
Office Version
  1. 2016
Platform
  1. Windows
Hi,

I have 3 separate command buttons on my worksheet and I would like to call the same userform but I would like the label1 in the userform to have different title when it opens.

My command buttons are CommandButtonB, CommandButtonG, CommandButtonR and the userform is UserForm2.

Any help would be appreciated.

Thanks
Dan
 

Some videos you may like

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

fadee2

Active Member
Joined
Nov 7, 2020
Messages
335
Office Version
  1. 2019
Platform
  1. Windows
use the following under each of your command buttons
VBA Code:
UserForm1.Caption = "Command Button R"
UserForm1.Show
 

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
17,409
Office Version
  1. 2013
Platform
  1. Windows
Try something like this:
Make three buttons and put this script in the button.
Change the name in each script to what you want for the Label

VBA Code:
Sub Show_Me()
'Modified  12/15/2020  2:10:30 AM  EST
Userform1.Label1.Caption = "Jane"
Userform1.Show Modeless
End Sub
 
Solution

danbates

Active Member
Joined
Oct 8, 2017
Messages
357
Office Version
  1. 2016
Platform
  1. Windows
Thank you to both of you. Just what I was after.
 

fadee2

Active Member
Joined
Nov 7, 2020
Messages
335
Office Version
  1. 2019
Platform
  1. Windows
you are welcome....
 

Watch MrExcel Video

Forum statistics

Threads
1,127,334
Messages
5,624,089
Members
416,010
Latest member
NJT

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
Top