Basic knowledge of VBA

Source: Internet
Author: User

    1. VBA is the editing language, and macros are programs that are saved with VBA code.
    2. VBA code starts with a "sub macro name" and a pair of empty parentheses, ending with "End Sub".
    3. The module is where the save process is, and a module can hold several different types of processes.
    4. objects, workbooks, worksheets, cells, pictures, charts, pivot tables, etc.
    5. Each object has a property, which is the content or feature that the object contains. (object. Properties)
    6. Some properties of an object are also objects, and properties and objects are relative.
    7. Each object has a method, which refers to an action performed on the object. (object. Method)
    8. 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

    1. 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
    2. 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

    1. removing modules

Method 1: Select module, File-Remove module

In Project Explorer, right-click the module and select Remove Module

    1. Before you write a program, you need to add an empty procedure
      1. Double-click the module to activate its code window
      2. Insert--Process
      3. Set the procedure name "mysub", OK
      4. Get Public Sub MySub () End Sub
    2. Shortcut keys for execution: F5
    3. 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.