One of the summary of VBA development experience: using the Range object to design the user interface, vbarange

Source: Internet
Author: User

One of the summary of VBA development experience: using the Range object to design the user interface, vbarange

After reading "EXCEL Professional Development", the biggest shock is the author's pursuit of VBA technology and the design of Excel art. Inspired by the author of this book, I also intend to sum up some of my daily development experience to serve as my knowledge reserve and share it on the Internet.

The formatting of Excel formulas, functions, and cells provides great convenience for UI design. This content is detailed in "Excel Professional Development", so you don't have to go into details. In this book, we also discuss pre-defined names. Predefined names are an important part of worksheet user interface design, including predefined naming constants, naming regions, and naming formulas. This article will summarize the role of the naming area in the uidesign.

1. You can name different regions according to specific data requirements to ensure the independence of each part of information and facilitate data verification or regional verification, for example, you can name the customer information and sales information in the sales analysis respectively to analyze the data or information of the two parts.

After using this method, you can determine whether or not the relevant naming area is selected. Some functions related to the area can be used:

Application.Intersect   Application.Union

2. You can set up indexes for each column in the named area using the enumeration type, so that the UI can be modified in a unified manner.

3. flexible use of relative references to absolute references.

4. Use the worksheet Protect method to Protect the UI, so as to prevent accidental input of bad data and damage the consistency.

5. Set the title row and data row to a Public constant variable for use.

6. Change the number of rows used to the worksheet attribute for easy calling.

PS Special TIPS of several VBA:

1. IF of VBA does not support conditional short circuit;

2. open the file in EXCEL of different processes.

With Application   .DisplayAlerts = False   .IgnoreRemoteRequests = True   .DisplayAlerts = True  End With

How to add an excel vba range object?

Directly write the result of adding to another cell
Range ("c1") = Range ("a1") + Range ("b1 ")
Save the addition result to a variable.
I = Range ("a1") + Range ("b1 ")

Use of range objects in word vba

You have the right idea:
S1 = ActiveDocument. Range. Start
S2 = ActiveDocument. Range. End

S1 returns the beginning of the activity document
S2 returns the end Of the activity document

To move the cursor to the end of the document, write as follows:
Selection. MoveRight Unit: = wdWord, Count: = 1

Related Article

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.