Thread: Paint a cell ?
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Paint a cell ?

If you know your range, I would use

Dim oRow As Range
Dim iCol As Long

For Each oRow In Columns(3).Rows
If Application.Count(oRow) 0 Then
iCol = Application.Match(Application.Max(oRow), oRow, 0)
Cells(oRow.Row, iCol).Interior.Color = vbRed
End If
Next oRow


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Kleev" wrote in message
...
This appears to work for me:
Cells(oRow.Row, iCol + Selection.Column - 1).Interior.Color = vbRed

"Kleev" wrote:

When I tried the below, I originally got some strange results. After a
little debugging I tried moving my selection so that it started in

Column A
and then everything worked as expected. What change would be necessary

to
make this work if the selection range started elsewhere, say in column

c?

"Bob Phillips" wrote:

Maybe

Dim oRow As Range
Dim iCol As Long

For Each oRow In Selection.Rows
If Application.Count(oRow) 0 Then
iCol = Application.Match(Application.Max(oRow), oRow, 0)
Cells(oRow.Row, iCol).Interior.Color = vbRed
End If
Next oRow


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Skic" wrote in message

...
Hi all!

I've got a problem and ask for help.

I need some macro that will highlight (paint) a cell in each row

where is
the highest value in this row.

Thanks !