ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   selecting a column in XL (https://www.excelbanter.com/excel-programming/346452-selecting-column-xl.html)

Elaine

selecting a column in XL
 
Currently Col A in my spreadsheet has only the col Heading (Number). I need
to select all cells from A2 to the last row that contains data. Col B has
data but the data there is not consecutive. There are cells in Col B that do
not contain data.

Can someone show me how I can use ActiveSheet.UsedRange.Rows.Count (if that
is indeed the best way to proceed) to capture the number of rows and then
select and number everything in cell A2 to the last cell in Col A?

Any help offered appreciated. Thank you.

Leith Ross[_326_]

selecting a column in XL
 

Hello Elaine,

To find the row number of the last cell for a particular column, us
the following code...

With ActiveSheet
LastRow = Cells(.Rows.Count, "C").End(xlUp).Row
End With

To Select from A2 to the last row in Column A, use the following...

Range("A2:A" & LastRow).Select

Siincerely,
Leith Ros

--
Leith Ros
-----------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...fo&userid=1846
View this thread: http://www.excelforum.com/showthread.php?threadid=48771



All times are GMT +1. The time now is 05:39 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com