View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
gaba gaba is offline
external usenet poster
 
Posts: 83
Default nested loops trouble

Thanks crispbd for your answer. I'm looking for different values in column B,
if value is = (P, Na, Ca, etc.) then look through the columns and check for
the upper limits
ColB
P 'Check if values are 5000
Na 'Check if values are 5500
Ca 'Check if values are 500

if value is bigger than limit, set interior.ColorIndex to 44
My problem is once I found the value in column B (by looping through the
rows) check values through the columns. I started thinking I'm using the
wrong approach...


"crispbd" wrote:


I don't think you need nested loops to make this work (if i understand
your question correctly). You simply want to look through column B for
either value errors or for values over 5000 and if found, make the
cells orange?

Dim PaintColor As Integer
Dim RowCount As Long
Dim InterestedCol As Integer
Dim MyCell As Object

On Error Resume Next

PaintColor = 46
InterestedCol = 2

For RowCount = 1 To UsedRange.Rows.Count
Set MyCell = Cells(RowCount, InterestedCol)

If IsError(MyCell.Value) Or MyCell.Value 5000 Then
MyCell.Interior.ColorIndex = PaintColor
End If

Next RowCount


--
crispbd
------------------------------------------------------------------------
crispbd's Profile: http://www.excelforum.com/member.php...o&userid=10880
View this thread: http://www.excelforum.com/showthread...hreadid=274070