In last post Excel Macro Tutorial : Visual Basic Editor in Excel we saw how to add different Controls in your Excel Macro. To Read All the Excel Macro Tutorial Click Here.
Each and Every VBA controls has their own by default properties. Like Name of the Control, height, width, Caption, color, background, font color etc. In Excel other than All these VBA controls like Command Button, Radio Button, Textbox etc. Worksheets also has its own properties.
So let’s see how we can see and change the properties of a control added in your excel Sheet.
Step 1. In below Excel Sheet we have 2 controls, 1 Command Button and One Combobox
Press Right Click on the Control for which you want see or change the Properties of that Control.
Step 2. Click on Properties
Step 3. Property Window is visible now. On top you can see all the Controls added to your Sheet along with the Sheet Name. By default that control will be selected on which you had right clicked and selected the “Properties”. From here you can select any of the Control for which you want to view the Property.
Step 4. For Example: In the above Picture you can see Property of the CommandButton1 is displayed.
On Top you can see there is a Property called “Name”. This is the Name of that Control. This should always be unique in the Excel Workbook as each and Every Control is uniquely identified by this name.
When you add a new Control is added to the Sheet, by default a unique name is given to that control like RadioButton1, RadioButton2 etc.
It is always a good habit to change the name of your Controls based on it’s functionality. So that when you have lot’s of controls then it’s easy to remember the control names while writing code.
Similarly you can Change following ActiveX Control Properties:
1. VBA Textbox Property
2. VBA Combobox Property
3. VBA CheckBox Property
4. VBA ListBox Property
5. VBA ScrollBar Property
6. VBA Spin Button Property
7. VBA Radio Button Property (Option Button property)
8. VBA Label Property
9. VBA Toggle Button Property
……. and so many other ActiveX Controls
Note: Here I have not given Screen Shots and Steps for all the Properties of all the Controls. But if you are facing any issues in Properties of any Control or any other Issues or Solution related to Excel, just Give a reply to this post with your doubt or question or email me at [email protected]
To Check out more Excel Macro Tutorials, visit Excel Macro Tutorial