Other Methods of Selecting Ceils

If you often have to quickly access certain remote cells in your worksheet, you may already be familiar with the following keyboard shortcuts: End+Up Arrow, End+Down Arrow, End+Left Arrow, and End+Right Arrow. In VBA, you can use the End property to quickly move to remote cells.

To render this into VBA: Enter this in the Immediate window:

Select the last cell in any row. ActiveCell.End(xlright).Select

Select the last cell in any column. ActiveCell.End(xldown).Select

Select the first cell in any row. ActiveCell.End(xleft).Select

Select the first cell in any column. ActiveCell.End(xlup).Select

Notice that the End property requires an argument that indicates the direction you want to move. Use the following Excel built-in constants to jump in the specified direction: xlright, xleft, xlup, xldown.

0 0

Post a comment