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

smallxyz

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

Kyle123

Well-known Member
Joined
Jan 24, 2012
Messages
2,684
This sounds a little bit odd if you don't mind me saying. Why do you need to change their names?
 

John_w

MrExcel MVP
Joined
Oct 15, 2007
Messages
6,001
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.
 

Forum statistics

Threads
1,082,548
Messages
5,366,227
Members
400,880
Latest member
dwb

Some videos you may like

This Week's Hot Topics

Top