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.
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 .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.