I have a table in an excel sheet and I want to select the entire first row. Is there an easier/faster way to reference a table than the normal
Range("A2").End(xlDown).Select
method? Seems that by using a Table I should gain an easier access route to the data. Thanks.
You can also click anywhere in the table column, and then press CTRL+SPACEBAR, or you can click the first cell in the table column, and then press CTRL+SHIFT+DOWN ARROW. Note: Pressing CTRL+SPACEBAR once selects the table column data; pressing CTRL+SPACEBAR twice selects the entire table column.
To manually select all the data in a column, select the first cell, and press CTRL+SHIFT+DOWN ARROW.
With these codes you can select different parts of a table.
Entire Table:ActiveSheet.ListObjects("Table1").Range.Select
Table Header Row:ActiveSheet.ListObjects("Table1").HeaderRowRange.Select
Table Data:ActiveSheet.ListObjects("Table1").DataBodyRange.Select
Third Column:ActiveSheet.ListObjects("Table1").ListColumns(3).Range.Select
Third Column (Data Only):ActiveSheet.ListObjects("Table1").ListColumns(3).DataBodyRange.Select
Select Row 4 of Table Data:ActiveSheet.ListObjects("Table1").ListRows(4).Range.Select
Select 3rd Heading:ActiveSheet.ListObjects("Table1").HeaderRowRange(3).Select
Select Data point in Row 3, Column 2:ActiveSheet.ListObjects("Table1").DataBodyRange(3, 2).Select
Subtotals:ActiveSheet.ListObjects("Table1").TotalsRowRange.Select
For a full guide on tables see The VBA Guide To ListObject Excel Tables.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With