Article ID: 89949 - View products that this article applies to.
This article was previously published under Q89949
In Microsoft Excel, you can select all the data on your worksheet by pressing the key combination CTRL+SHIFT+END (CONTROL+SHIFT+END on Macintosh). You can also simulate these keystrokes in the macro described in this article.
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers 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 requirements.
Sample Visual Basic ProcedureThe following procedure selects data from the currently selected cell, to the end of the data on your worksheet.
You can easily modify the procedure to select from a specific cell by adding the following statement to the beginning of the procedure:
Range("B2").Selectwhere B2 is the reference of the specific cell.
Microsoft Excel version 4.0 MacroThe following macro selects data from the currently selected cell, to the end of the data on your worksheet. You can easily modify the macro to select from a specific cell by changing the SELECT() function in cell A2 to select the starting cell you want.
For example, to select from the first cell (R1C1) on your worksheet, change the SELECT() function in A2 to read: =SELECT("R1C1").
To create and run this macro:
"Microsoft Excel User's Guide 2," version 4.0, pages 231-238For additional information about getting help with Visual Basic for Applications, please see the following article in the Microsoft Knowledge Base:
"Microsoft Excel Function Reference," version 4.0, pages 191-194, 238- 239, 349-350, 378-379
"Microsoft Excel User's Guide," version 3.0, pages 595-600
"Microsoft Excel Function Reference," version 3.0, pages 103-105, 129, 192-193, 209-210
(http://support.microsoft.com/kb/163435/EN-US/ )Programming Resources for Visual Basic for Applications
Article ID: 89949 - Last Review: November 16, 2006 - Revision: 2.4