- VBA is the editing language, and macros are programs that are saved with VBA code.
- VBA code starts with a "sub macro name" and a pair of empty parentheses, ending with "End Sub".
- The module is where the save process is, and a module can hold several different types of processes.
- objects, workbooks, worksheets, cells, pictures, charts, pivot tables, etc.
- Each object has a property, which is the content or feature that the object contains. (object. Properties)
- Some properties of an object are also objects, and properties and objects are relative.
- Each object has a method, which refers to an action performed on the object. (object. Method)
- VBA Editing Environment--vbe (Visual Basic Editor)
To enter the VBE method:
1. <alt + f11> 2. Right-click the worksheet and select View Code 3. Visual Basic under Developer
- Immediately after the command is entered in the View-immdediate window, a return will show the result of the command execution. If the Immediate window is not displayed, the shortcut key CTRL + G
- Because VBA programs are generally stored in modules, a module is added first.
Method 1: Insert in menu bar--Module
Method 2: Right-click the left-hand side [Project Explorer], select Insert--module
- removing modules
Method 1: Select module, File-Remove module
In Project Explorer, right-click the module and select Remove Module
- Before you write a program, you need to add an empty procedure
- Double-click the module to activate its code window
- Insert--Process
- Set the procedure name "mysub", OK
- Get Public Sub MySub () End Sub
- Shortcut keys for execution: F5
- Shortcut keys for help: F1,vba with an encyclopedia (you must move the cursor to the middle of the search term)
Basic knowledge of VBA