One property of the Range object that is extremely useful for navigational activities is the End property. If you are used to navigating around Excel using the Control key in conjunction with the arrow keys, you already know how End behaves—End is the programmatic equivalent of navigating using Control in conjunction with the arrow keys. If you don't know what I'm talking about, it'll be helpful to perform the following exercise to see for yourself.
1. On a blank worksheet in Excel, select the range A1:C10.
2. Press the numeral 1 key and then press Ctrl+Shift+Enter to populate every cell in the range with the value 1.
3. Also, place the value 1 in the cells A12:A15, B14, C12, and D13:D14, as shown in Figure 8.10.
4. Select cell A1.
5. Press Ctrl+Down Arrow to select cell A10.
6. Press Ctrl+Right Arrow to select cell C10.
7. Continue experimenting with Ctrl+(Up/Down/Right/Left) Arrow until you have a good feel for how this behaves.
The general algorithm of this functionality is as follows. If the current cell is empty, then select the first nonempty cell in the direction specified by the arrow key. If a nonempty cell can't be found, select the cell next to the boundary of the worksheet.
Was this article helpful?