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

smallxyz

Active Member
Joined
Jul 27, 2015
Messages
393
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

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
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,223,639
Messages
6,173,499
Members
452,517
Latest member
SoerenB

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