ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   find row (https://www.excelbanter.com/excel-programming/351529-find-row.html)

[email protected][_2_]

find row
 
Im using:

Range(Cells(Range("b:b").find("e0").Row, 1), _
Cells(Range("b:b").find("e1").Row - 1, 1)).Columns("A:z").Select
to select all the rows containing 'EO' then sorting the data with

Selection.Sort Key1:=Range("K3"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

This all works great if the data is at the beginning of the worksheet,
the problem I have is that I also use the above to select any row with
'e2' in, not a problem selecting just sorting, because the range for
sort can vary from k20 to k30, is the a simple way that when ive
selected the data I can tell what Range the first row starts at. eg if
I could tell it started at A25 I could the trim and put K25 into sort
range. The data to sort is always in the k column, and never mixed up.

Regards Robert


Tom Ogilvy

find row
 
selection(1).Row

--
Regards,
Tom Ogilvy


wrote in message
oups.com...
Im using:

Range(Cells(Range("b:b").find("e0").Row, 1), _
Cells(Range("b:b").find("e1").Row - 1, 1)).Columns("A:z").Select
to select all the rows containing 'EO' then sorting the data with

Selection.Sort Key1:=Range("K3"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

This all works great if the data is at the beginning of the worksheet,
the problem I have is that I also use the above to select any row with
'e2' in, not a problem selecting just sorting, because the range for
sort can vary from k20 to k30, is the a simple way that when ive
selected the data I can tell what Range the first row starts at. eg if
I could tell it started at A25 I could the trim and put K25 into sort
range. The data to sort is always in the k column, and never mixed up.

Regards Robert




[email protected][_2_]

find row
 
thanks tom, easy when you know how
Regards Robert



All times are GMT +1. The time now is 11:01 PM.

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