Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Paint a cell ?
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 ! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Paint a cell ?
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 ! |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Paint a cell ?
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 ! |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Paint a cell ?
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 ! |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 ! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I copy a picture from Paint to a specific cell in Excel? | Excel Discussion (Misc queries) | |||
Need conditional statement to paint a cell | Excel Discussion (Misc queries) | |||
Need conditional statement to paint a cell | Excel Worksheet Functions | |||
can you tell me how to embed a pic for paint into an excel cell | Excel Worksheet Functions | |||
Use VBA to format paint cell(s) | Excel Programming |