How To Change the value/content of several UserForm-controls using VBA in Excel?
Tags: tochangethevaluecont, vbamacros
Published: 2021-10-14 02:42:07

---
title: How To Change the value/content of several UserForm-controls using VBA in Excel?
published: true
date: 2021-10-13 09:17:37 UTC
tags: ToChangeTheValueCont,VBAMacros
canonical_url: https://geekexcel.com/how-to-change-the-value-content-of-several-userform-controls-using-vba-in-excel/
---

In this tutorial, we will guide you on how to  **change the value/content of several UserForm-Controls using VBA ** in Microsoft Excel. Let’s get them below!! Get an official version of MS Excel from the following link: **[https://www.microsoft.com/en-in/microsoft-365/excel](https://www.microsoft.com/en-in/microsoft-365/excel)**

## Example

- Firstly, in the Excel Worksheet, you have to go to the  **Developer Tab.**
- Then, you need to ** ** select the  **Visual Basic**  option under the  **Code**  section.

![Select Visual Basic](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2021/09/Select-Visual-Basic-9-1024x180.png)<figcaption>Select Visual Basic</figcaption>

- Now, you have to  **copy and paste the code**  given below.

```
Sub ResetAllCheckBoxesInUserForm()
Dim ctrl As Control
    For Each ctrl In UserForm1.Controls
        If TypeName(ctrl) = "CheckBox" Then
            ctrl.Value = False
        End If
    Next ctrl
End Sub

Sub ResetAllOptionButtonsInUserForm()
Dim ctrl As Control
    For Each ctrl In UserForm1.Controls
        If TypeName(ctrl) = "OptionButton" Then
            ctrl.Value = False
        End If
    Next ctrl
End Sub

Sub ResetAllTextBoxesInUserForm()
Dim ctrl As Control
    For Each ctrl In UserForm1.Controls
        If TypeName(ctrl) = "TextBox" Then
            ctrl.Text = ""
        End If
    Next ctrl
End Sub

```

- You need to  **save the code**  by selecting it and then  **close the window**.

![](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2021/10/Save-the-Code-41.png)<figcaption>Save the Code</figcaption>

- Again, you have to go to the  **Excel Spreadsheet** , and click on the  **Developer Tab**.
- Then, you need to choose the  **Macros option**  in the Code section.

![Choose Macro option](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2021/09/Choose-Macro-option-11-1024x184.png)<figcaption>Choose Macro option</figcaption>

- Now, you have to make sure that your  **macro name is selected**  and click the  **Run ** button.

![](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2021/10/Run-the-Code-33.png)<figcaption>Run the Code</figcaption>

- Finally, you can **change the value/content of several UserForm-controls**  in Excel.

## Closure

We hope that this tutorial gives you guidelines on how to  **change the value/content of several UserForm-Controls using VBA**  in Microsoft Excel. Please leave a comment in case of any  **queries,**  and don’t forget to mention your valuable  **suggestions**  as well. Thank you so much for Visiting Our Site!! Continue learning on **[Geek Excel](https://geekexcel.com/)!! **Read more on [**Excel Formulas**](https://geekexcel.com/excel-formula/) **!!**

**Read Also:**

- **[How to Create a Column Chart With Percentage Change in Excel?](https://geekexcel.com/how-to-create-a-column-chart-with-percentage-change-in-excel/)**
- **[Change the Chart Type in Excel Office 365 ~ With Clear-Cut Examples!!](https://geekexcel.com/how-to-create-a-column-chart-with-percentage-change-in-excel/)**
- **[How to Change the Date Format in Excel Office 365? ~ Complete Guide!!](https://geekexcel.com/how-to-create-a-column-chart-with-percentage-change-in-excel/)**
- **[Change the Time Format in Excel Office 365 ~ Useful Guide!!](https://geekexcel.com/how-to-create-a-column-chart-with-percentage-change-in-excel/)**
- **[Excel Formulas to Get the Percent Change ~ Quick Method!!](https://geekexcel.com/how-to-create-a-column-chart-with-percentage-change-in-excel/)**