ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Range Selection - From Lowest 2 Highest Values? (https://www.excelbanter.com/excel-programming/434633-range-selection-lowest-2-highest-values.html)

Faraz A. Qureshi

Range Selection - From Lowest 2 Highest Values?
 
I usually have a long list of accounts imported with account numbers in 12
digits' numbers. The same is however already sorted. How to select the range
of codes, from lowest to the highest codes?

For example:

1. In the currently active column;

2. Select FROM the minimum value above 000000000000;

3. UPTO the maximum value below 1000000000000;

--
Best Regards,

Faraz

Jacob Skaria

Range Selection - From Lowest 2 Highest Values?
 
Try the below with data in Col A

Dim rngTemp As Range, lngMinRow As Long, lngMaxrow As Long
Set rngTemp = Columns("A")
lngMinRow = rngTemp.Find(WorksheetFunction.Min(rngTemp)).Row
lngMaxrow = rngTemp.Find(WorksheetFunction.Max(rngTemp)).Row
Range("A" & lngMinRow & ":A" & lngMaxrow).Select

If this post helps click Yes
---------------
Jacob Skaria


"Faraz A. Qureshi" wrote:

I usually have a long list of accounts imported with account numbers in 12
digits' numbers. The same is however already sorted. How to select the range
of codes, from lowest to the highest codes?

For example:

1. In the currently active column;

2. Select FROM the minimum value above 000000000000;

3. UPTO the maximum value below 1000000000000;

--
Best Regards,

Faraz


Faraz A. Qureshi

Range Selection - From Lowest 2 Highest Values?
 
Just as usual buddy!

U R simply the best!
--
Best Regards,

Faraz


"Jacob Skaria" wrote:

Try the below with data in Col A

Dim rngTemp As Range, lngMinRow As Long, lngMaxrow As Long
Set rngTemp = Columns("A")
lngMinRow = rngTemp.Find(WorksheetFunction.Min(rngTemp)).Row
lngMaxrow = rngTemp.Find(WorksheetFunction.Max(rngTemp)).Row
Range("A" & lngMinRow & ":A" & lngMaxrow).Select

If this post helps click Yes
---------------
Jacob Skaria


"Faraz A. Qureshi" wrote:

I usually have a long list of accounts imported with account numbers in 12
digits' numbers. The same is however already sorted. How to select the range
of codes, from lowest to the highest codes?

For example:

1. In the currently active column;

2. Select FROM the minimum value above 000000000000;

3. UPTO the maximum value below 1000000000000;

--
Best Regards,

Faraz



All times are GMT +1. The time now is 10:22 PM.

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