There are 2 types of Procedures in Visual Basic. These are, Public and Private.
Public Procedure:
Public procedure is accessible from any module of the same workbook. By default procedure is Public Procedure in Excel VBA. If you run the macro dialog box, then you will see the Macro list which is recorded or written as Public procedure.
Public Procedure can accessible from any other module or any others opened workbook. If we write with a Sub code then by default it counted as Public Procedure. Public Procedure always displayed in Macro list box:
Private Procedure:
Private procedure is only accessible with the same module where the private sub procedures present in the same module of the same workbook. You will see the Private procedures only while you select the Personal workbook from macro dialog box.
Private Procedure can't display in Macro list dialog box due to it is not accessible by others opened workbook or within the same workbook but different modules.
Save the file .xlsm and exit the file for today.
Image 1: Types of Procedure
Public Procedure:
Public procedure is accessible from any module of the same workbook. By default procedure is Public Procedure in Excel VBA. If you run the macro dialog box, then you will see the Macro list which is recorded or written as Public procedure.
Image 2: Two different types of Public Procedure Example
Public Procedure can accessible from any other module or any others opened workbook. If we write with a Sub code then by default it counted as Public Procedure. Public Procedure always displayed in Macro list box:
Image 3: Public Procedure always shows in Macro list
Private Procedure:
Private procedure is only accessible with the same module where the private sub procedures present in the same module of the same workbook. You will see the Private procedures only while you select the Personal workbook from macro dialog box.
Image 4: Private Procedure Example
Private Procedure can't display in Macro list dialog box due to it is not accessible by others opened workbook or within the same workbook but different modules.
Image 5: Private Procedure not displayed in Macro list
Save the file .xlsm and exit the file for today.