The information in this article applies to:
SUMMARY
To automate a task or perform an operation when data is entered into a
specific range on a Microsoft Excel worksheet, you can use the OnEntry and
Intersect methods in a Visual Basic for applications macro. You can use
this type of macro to validate data entry, to verify that a value is within
a specified range, for example.
MORE INFORMATIONMicrosoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web: http://www.microsoft.com/support/supportnet/overview/overview.aspThe following sample macro generates the default system sound when valid data is entered in to a defined area of a worksheet. In this example, valid data is defined as a numeric value between the range of 0 and 100. To use the following macros, use these steps to set up your Microsoft Excel workbook:
When you enter appropriate data in the range A1:A10 on Sheet1, you will hear the default system sound. If you enter data that is outside the specified range (in this case any value that is not in the range 0- 100), a dialog box will be displayed. REFERENCESFor more information about Data Validation, click the Index tab in Microsoft Excel 97 Help, type the following text data validation, preventing incorrect entryand then double-click the selected text to go to the "Prevent entry of incorrect data in a cell" topic. For more information about OnEntry or Intersect, click the Index tab in Microsoft Excel 7.0 Help, type either of the following OnEntryand then double-click the selected text to go to the desired topic. Additional query words: 8.00 97 Data Entry Validate
Keywords : kbprg kbdta kbdtacode PgmHowto KbVBA |
Last Reviewed: November 9, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |