A summary of VBA development experience: Designing a user interface with a Range object

Source: Internet
Author: User

Read the "Excel Professional Development", the biggest shock is the author of the Pursuit of VBA technology and the design of Excel works of art. Inspired by the author, he also intends to summarize some of his experiences in daily development, as a reserve of knowledge and to share it on the Internet.

Excel formulas, functions, and the formatting of their own cells provide a great convenience for the design of the UI, which is detailed in the Excel Professional Development section. In this book, the predefined names are also discussed. It is mentioned that the predefined names are an important part of the design of the user interface of the worksheet, including predefined named constants, named ranges, and named formulas. This article will focus on the role of named areas in UI design to make a summary.

1, according to the specific data requirements can be named in different regions, to ensure the independence of each part of the information, convenient data validation or regional verification requirements, such as in the sales analysis of customer information and sales information are named, respectively, analysis of two parts of the data or information.

In this way, determine if the relevant named range is selected to take some functions related to the region:

Application.intersect   Application.Union

2. Each column item can be indexed in an enumerated type within a named range, so that the UI changes uniformly when changed.

3, flexible use relative reference to absolute reference.

4, using the Protect method of the worksheet to protect the UI, prevent user actions inadvertently input bad data, breach of consistency.

5. Use the constant variable that sets the header row and data row to public.

6, the use of the number of rows into the properties of the worksheet, easy to call.

PS several special tips for VBA:

1, if the VBA does not support the condition short circuit;

2. Open the file using Excel from a different process.

 with Application    False     truetrue     End with

A summary of VBA development experience: Designing a user interface with a Range object

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.