How to Remove a Form Control in Excel (3 Ways)

The List of Employee Names dataset displays the ID and Employee Names. We can use the Scroll Bar to move across the list of employees. You can remove Form Controls in many ways using Excel’s built-in options and VBA code.

how to remove a form control in excel


Method 1 – Using Find and Select Option

Steps:

  • Click the Find & Select option in the Editing group >> Click the Go To Special option.

Using Find and Select Option

This opens the Go To Special wizard.

  • Choose Objects >> Press the OK button.

Go To Special Window

  • Select all the objects in the worksheet >> press DELETE.

Selecting Form Controls

This eliminates the Scroll Bar, as shown in the image below.

how to remove a form control in excel with Find & Select option

Read More: Key Differences in Excel: Form Control Vs. ActiveX Control


Method 2 – Using a Keyboard Shortcut

Steps:

  • Press the F5 key, which opens the Go To dialog box.
  • Click the Special option at the bottom.

Using Keyboard Shortcut

  • Choose Objects >> Click OK.

Select Objects

  • Press DELETE to remove the Form Control object.

Selecting Scroll Bar

Your output should look like the picture given below.

how to remove a form control in excel with keyboard shortcut

Read More: How to Use Form Controls in Excel


Method 3 – Applying VBA Code

 

3.1 Removing Form Controls Buttons

Steps:

  • Go to the Developer tab >> Click the Visual Basic button.

Removing Form Controls Buttons

This opens the Visual Basic Editor in a new window.

  • Go to the Insert tab >> select Module.

Inserting Module

Copy the code from here and paste it into the window below:

Sub Remove_Form_Control_Buttons()
    Dim FrmCtrl_button As Object
    On Error Resume Next
    
    ActiveSheet.Buttons.Delete
    For Each FrmCtrl_button In ActiveSheet.OLEObjects
        If TypeName(FrmCtrl_button.Object) = "CommandButton" Then
            FrmCtrl_button.Delete
        End If
    Next
End Sub

Inserted VBA Code

Code Breakdown:

Now, I will explain the VBA code removing Form Controls, which is divided into 2 steps.

  • In the first portion, the sub-routine is given a name, here it is Remove_Form_Control_Buttons().
  • Next, define the variables FrmCtrl_button as Objects.
  • In the second potion, use the For Loop and the If statement to remove the objects from the worksheet using the Delete method.

how to remove a form control in excel

  • Close the VBA window >> click the Macros button.

This opens the Macros dialog box.

  • Select the Remove_Form_Control_Buttons macro >> Press Run.

Running VBA Code

The results should look like the screenshot given below.

how to remove a form control in excel with VBA Code


3.2 Removing Form Controls Checkboxes

Steps:

  • Run Steps 1-2 from the previous methods to open the Visual Basic editor, insert a new module and enter the code:
Sub Remove_Form_Control_Checkboxes()
For Each FrmCtrl_ChBox In ActiveSheet.Shapes
    If FrmCtrl_ChBox.Type = msoFormControl Then
        If FrmCtrl_ChBox.FormControlType = 1 Then FrmCtrl_ChBox.Delete
    End If
Next
End Sub

Inserted Code into Module

Code Breakdown:

Now, I will explain the VBA code removing Form Controls.

  • First, the sub-routine is given a name, here it is Remove_Form_Control_Checkboxes().
  • Next, use the For Loop and the If statement to loop through all the cells and remove the checkboxes.

how to remove a form control in excel

  • Close the VBA window >> click the Macros button >> run the Remove_Form_Control_Checkboxes macro.

Running the macro

The results should appear in the image given below.

how to remove a form control in excel with VBA


3.3. Removing All Form Controls

Steps:

  • Open the Visual Basic editor >> insert a new module and copy and paste the code:
Sub Remove_All_Objects()
    On Error Resume Next
    ActiveSheet.DrawingObjects.Visible = True
    ActiveSheet.DrawingObjects.Delete
    On Error GoTo 0
End Sub

VBA Code in the Module window

Code Breakdown:

Here, I will explain the code for eliminating all Form Controls objects.

  • In the first portion, the sub-routine is given a name; here, it is Remove_All_Objects().
  • Next, use the ActiveSheet.DrawingObjects property to make all the objects visible, and then use the Delete method to remove them.

how to remove a form control in excel

  • Exit the VBA window >> press the Macros button >> execute the Remove_All_Objects macro.

Running macro to remove all objects

Your output should look like the picture given below.

how to remove a form control in excel to remove all form controls


How to Delete a Macro Button in Excel

Considering the Project List dataset, which contains the Names of the staff and their designated Project Names, respectively, we can click the Run Macro button to highlight each project in a different color. How to Delete a Macro Button in Excel

Steps:

  • Execute Steps 1-2 from the previous methods to open the Visual Basic editor, insert a new module, and enter the VBA code:
Sub Remove_All_Objects()
    On Error Resume Next
    ActiveSheet.DrawingObjects.Visible = True
    ActiveSheet.DrawingObjects.Delete
    On Error GoTo 0
End Sub

code for removing macro button

  • Close the VBA window >> click the Macros button >> run the Remove_All_Objects macro.

executing macro

This eliminates the macro button, as shown in the screenshot below.

how to remove a form control in excel


Practice Section

We have provided a Practice section on the right side of each sheet so you can practice.

Practice Section


Download the Practice Workbook

You can download the practice workbook from the link below.


Related Articles


<< Go Back to Form Control in Excel | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Eshrak Kader
Eshrak Kader

Eshrak Kader is a dedicated professional with a BSc. Degree in Naval Architecture and Marine Engineering from Bangladesh University of Engineering and Technology. He boasts a rich background in Microsoft Office Suite, and over the past year, he has authored over 120 insightful articles for the ExcelDemy. Currently, Eshrak leads a team of 5 in the ExcelDemy Video project and enjoys problem-solving and making videos on Excel. Eshrak’s passion for continuous learning underscores his commitment to excellence in... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo