Colouring cells in column by smallest value

teamsimpson

New Member
Joined
Sep 20, 2002
Messages
22
Does anyone have a piece of code that will
1)colour a cell in a column which has the smallest value (numerical), i need to apply this to columns c,d,e and f
2)colour a cell in a column which has the largest value (numerical),i need to apply this to columns g and h.
Thanks
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
Assuming the data is in rows 1 to 5:

1. Select range C1:F5 and choose Format, Conditional Formatting. Formula Is:

=C1=MIN(C$1:C$5)

choose your Format and click OK.

2. Select range G1:H5 and choose Format, Conditional Formatting. Formula Is:

=G1=MAX(G$1:G$5)

choose your Format and click OK.
 

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
Well can't you record your actions following my suggestion then use that in your code? Or is there a reason you don't want to use conditional formatting?
 

teamsimpson

New Member
Joined
Sep 20, 2002
Messages
22

ADVERTISEMENT

Sorry i did'nt realise that you could record that sort of thing, including formula etc.
 

teamsimpson

New Member
Joined
Sep 20, 2002
Messages
22
The conditional format works fine, how would the formula look if the min ar max values were times, ie. 2'54"76, or 51"28
This message was edited by teamsimpson on 2002-10-14 12:12
 

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
It should work provided that the time is decimal formatted as hh:mm:ss. Is that the case?
 

teamsimpson

New Member
Joined
Sep 20, 2002
Messages
22
no unfortunatley the worksheet if from another file, it is input into my file as an embedded object, the some column values are decimal numbers and other columns are times for example, 2'54"76 which is 2minutes and 54.76 seconds
 

Forum statistics

Threads
1,144,510
Messages
5,724,781
Members
422,578
Latest member
annsalinas

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
Top