Select the Last Cell of a Column of Contiguous Data
To select the last cell in a contiguous column D, use the following example:
ActiveSheet.Range("D1").End(xlDown).Select
Select the Blank Cell at Bottom of a Column of Contiguous Data
To select the cell below a range of contiguous cells, use the following example:
ActiveSheet.Range("E1").End(xlDown).Offset(1,0).Select
Select an Entire Range of Contiguous Cells in a Column
To select a range of contiguous cells in a column, use one of the following examples:
ActiveSheet.Range("B1", ActiveSheet.Range("B1").End(xlDown)).Select
-or-
End(xlDown).Address).Select
-or-
End(xlUp).Address).Select
ActiveSheet.Range("A1").End(xlDown).End(xlToRight)).Select
-or-
ActiveSheet.Range("A1").End(xlDown).End(xlToRight).Address).Select
lastRow = ActiveSheet.Cells(65536, lastCol).End(xlUp).Row
ActiveSheet.Range("a1", ActiveSheet.Cells(lastRow, lastCol)).Select
-or-
lastRow = ActiveSheet.Cells(65536, lastCol).End(xlUp).Row
ActiveSheet.Range("a1:" & ActiveSheet.Cells(lastRow, lastCol).Address).Select
When this code is used with the sample table, cells A1 through A4 will be selected.
How to Select an Entire Range of Non-Contiguous Cells in a Column
To select a range of cells that are non-contiguous, use one of the following examples:
ActiveSheet.Range("A1",ActiveSheet.Range("A<lastRowInSheet>").End(xlUp)).Select
ActiveSheet.Range("A1:" & ActiveSheet.Range("A<lastRowInSheet>"). _
How to Select a Rectangular Range of Cells
In order to select a rectangular range of cells around a cell, use the CurrentRegion method. The range selected by the CurrentRegion method is an area bounded by any combination of blank rows and blank columns. The following is an example of how to use the CurrentRegion method:
ActiveSheet.Range("A1").CurrentRegion.Select
In some instances, you may want to select cells A1 through C6. The following examples will select all of the cells:
lastCol = ActiveSheet.Range("a1").End(xlToRight).Column
lastCol = ActiveSheet.Range("a1").End(xlToRight).Column
To select the last cell in a contiguous column D, use the following example:
ActiveSheet.Range("D1").End(xlDown).Select
Select the Blank Cell at Bottom of a Column of Contiguous Data
To select the cell below a range of contiguous cells, use the following example:
ActiveSheet.Range("E1").End(xlDown).Offset(1,0).Select
Select an Entire Range of Contiguous Cells in a Column
To select a range of contiguous cells in a column, use one of the following examples:
ActiveSheet.Range("B1", ActiveSheet.Range("B1").End(xlDown)).Select
-or-
End(xlDown).Address).Select
-or-
End(xlUp).Address).Select
ActiveSheet.Range("A1").End(xlDown).End(xlToRight)).Select
-or-
ActiveSheet.Range("A1").End(xlDown).End(xlToRight).Address).Select
lastRow = ActiveSheet.Cells(65536, lastCol).End(xlUp).Row
ActiveSheet.Range("a1", ActiveSheet.Cells(lastRow, lastCol)).Select
-or-
lastRow = ActiveSheet.Cells(65536, lastCol).End(xlUp).Row
ActiveSheet.Range("a1:" & ActiveSheet.Cells(lastRow, lastCol).Address).Select
When this code is used with the sample table, cells A1 through A4 will be selected.
How to Select an Entire Range of Non-Contiguous Cells in a Column
To select a range of cells that are non-contiguous, use one of the following examples:
ActiveSheet.Range("A1",ActiveSheet.Range("A<lastRowInSheet>").End(xlUp)).Select
ActiveSheet.Range("A1:" & ActiveSheet.Range("A<lastRowInSheet>"). _
How to Select a Rectangular Range of Cells
In order to select a rectangular range of cells around a cell, use the CurrentRegion method. The range selected by the CurrentRegion method is an area bounded by any combination of blank rows and blank columns. The following is an example of how to use the CurrentRegion method:
ActiveSheet.Range("A1").CurrentRegion.Select
In some instances, you may want to select cells A1 through C6. The following examples will select all of the cells:
lastCol = ActiveSheet.Range("a1").End(xlToRight).Column
lastCol = ActiveSheet.Range("a1").End(xlToRight).Column