ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   finding the number of rows and the first row with a specific value (https://www.excelbanter.com/excel-programming/331647-re-finding-number-rows-first-row-specific-value.html)

rjamison

finding the number of rows and the first row with a specific value
 
Hi

find the row number of the last row


MsgBox "The last row in active sheet is row No " _
& ActiveSheet.Range("A65536").End(xlUp).Row

row number of the first row that has a 1 in column A


MsgBox ActiveSheet.Range("A:A").Find(1, , xlValues, xlWhole,
xlByRows).Row

You may change Activesheet with Worksheets("YourSheetNameHere")
HTH
Cordially
Pascal

"Bruce Bowler" a écrit dans le message de
...

I have a bunch of spreadsheets where I want to

sort the entire sheet on column A and then column B (that part I can
handle)

The I want to find the first row in column A that has a 1 in it and

move
everything from that row thru the last row into a new sheet in the

same
workbook.

I know how to do it all manually, but since there are a bunch of these
files I'd like to do it in VBA. The part I'm not quite sure how to do
efficiently (I know how to do it inefficiently) is find the row number

of
the last row and the row number of the first row that has a 1 in

column A.

Any help and/or pointers would be appreciated...

Excel 2003 if it matters.

Thanks!
Bruce

--

+-------------------+---------------------------------------------------
+
Bruce Bowler | A fox should not be of the jury at a goose's

trial.
1.207.633.9600 | - Thomas Fuller
|

+-------------------+---------------------------------------------------
+




All times are GMT +1. The time now is 12:28 PM.

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