Highlight Min Separate Ranges

billandrew

Well-known Member
Joined
Mar 9, 2014
Messages
743
Good evening

Is there a way to highlight min value in separate ranges.

I am utilizing some code provided from an earlier thread. Could I use the following repeated?

The code is

[TABLE="width: 70"]
<colgroup><col width="70" style="width:53pt"> </colgroup><tbody>[TR]
[TD="width: 70"]Sub FormatMin()[/TD]
[/TR]
[TR]
[TD] [/TD]
[/TR]
[TR]
[TD] Dim Col As Integer[/TD]
[/TR]
[TR]
[TD] Dim Row As Integer[/TD]
[/TR]
[TR]
[TD] Dim Row2 as Integer[/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
[TR]
[TD] For Col = 1 To 11[/TD]
[/TR]
[TR]
[TD] For Row = 1 To 8[/TD]
[/TR]
[TR]
[TD]For Row2 = 9 to 18[/TD]
[/TR]
[TR]
[TD] [/TD]
[/TR]
[TR]
[TD] If Cells(Row, Col) = WorksheetFunction.Small(Columns(Col), 1) Then[/TD]
[/TR]
[TR]
[TD] [/TD]
[/TR]
[TR]
[TD] Cells(Row, Col).Font.Bold = True[/TD]
[/TR]
[TR]
[TD] End If[/TD]
[/TR]
[TR]
[TD] Next Row[/TD]
[/TR]
[TR]
[TD] Next Col[/TD]
[/TR]
[TR]
[TD="class: xl90"]Next Range[/TD]
[/TR]
[TR]
[TD]If cells(Row2,Col) =WorksheetFunction.Small(Columns(Col),1)Then[/TD]
[/TR]
[TR]
[TD]Cells(Row2,Col).Font.Bold = True[/TD]
[/TR]
[TR]
[TD]End If[/TD]
[/TR]
[TR]
[TD]Next Row2[/TD]
[/TR]
[TR]
[TD]Next Col[/TD]
[/TR]
[TR]
[TD]End Sub[/TD]
[/TR]
</tbody>[/TABLE]
 
You're welcome:-
"Do arrays need to be declared" If you normally declare your variables then "Yes".:- Google "Option Explicit"

The code works as below:-
The code First loops through the variant array "RW", NB:- The first index Value in "Rw" is 0.
At each loop of "Rw" the Range "Rng" is set.
This enables each range specified in "RW" to be looped through individually.
The variable "R" is first set to the first value in "Rng" Range, then in the loop "For each dn ..." , each value in "Rng" is compared to "R" to find lowest value. At the end of the "Dn" loop the variable "R" will have the lowest value.
As "R" is a range variable, "R" will have the "address"property, so we can give that cell the colour "Yellow.
This method is repeated for each "Rng" range.
 
Upvote 0

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Providing the explanation, in my opinion is the key to the learning process.

You and this forum are a tremendous resource in that process.

Thank you again!
 
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,310
Members
452,634
Latest member
cpostell

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top