A convenient way to batch rename ( not caption ) multiple command buttons on Userform ?

smallxyz

Active Member
Joined
Jul 27, 2015
Messages
392
Office Version
  1. 2021
Platform
  1. Windows
Hi,
I am creating an Userform with several command buttons on it.


Is there a way to batch rename them as :
cbButton1
cbButton2
cbButton3
cbButton4
cbButton5
… ?


Note: I hope to give new names to them. not to change their captions.
The way I am using now, is simply click on them 1-by-1, and the adjust the "name" field, which is not very efficient for a large size of command buttons.





Thanks a lot!
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
This sounds a little bit odd if you don't mind me saying. Why do you need to change their names?
 
Upvote 0
See https://www.tek-tips.com/viewthread.cfm?qid=1286170

The code might need tweaking for more recent Excel versions and the particular way you want to rename the buttons. Note that it also renames them in the userform's code module.

You will need to add the reference to MS VBA Extensibility, and Trust access to the VBA project via Macro Security in the Developer tab on the main Excel ribbon.
 
Upvote 0

Forum statistics

Threads
1,214,520
Messages
6,120,013
Members
448,935
Latest member
ijat

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