Vba view code developer tab in Excel
The View Code button is contained in the Controls group of the developer Tab.
This button is used to view or modify the code associated with the controls embedded in the sheet, which are highlighted.
Also, this button can be used to view macro code other than that are related to ActiveX controls.
The following figure shows the "View Code" button.
For illustration purpose, let us put a button control as shown below and associate a simple code to it.
The following is the code associated with the button control
- Private Sub CommandButton1_Click()
- Dim i As Integer
- Dim j As Long
- Dim d As Double
- Dim str As String
- MsgBox "This is a demo"
- End Sub
Now, to see the code associated with the button control, goto Design mode and select the button.
Now click on the 'View Code' button.
The user will be taken to theVBA editor containing the code related to the control.