Thread: Shading Rows
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Daminc[_7_] Daminc[_7_] is offline
external usenet poster
 
Posts: 1
Default Shading Rows


Hi Tom,

I've tried to use your code (modified for my sheet) and I've become
stuck:

Sub highlightrow()

Dim lastrow As Long, i As Long
lastrow = Cells(Rows.Count, 1).End(xlUp)
For i = 1 To lastrow
If Cells(i, "F").Value AND(=5,=<7) Then
Rows(i).Interior.ColorIndex = 3
ElseIf Cells(i, "F").Value 10 Then
Rows(i).Interior.ColorIndex = 5
Else
Rows(i).Interior.ColorIndex = xlNone
End If
Next

End Sub

This gets a 'Compile error; Expect: expression)

which leads to

-Expected: Expression. For example, when pasting code from the Object
Browser, you may have forgotten to specify a value for a named
argument.
Workbook.Add (X:= ) ' Error because no value assigned to
' named argument.

Either add a value for the argument, or delete the argument if it's
optional. -

I thought it would be just a matter of changing th <3 to AND(=5,=<7)
to make the condition between 2 values but obviously that's not the
case here.

I would be grateful if you could you show me where I've gone wrong and
why please.

Thank you


--
Daminc
------------------------------------------------------------------------
Daminc's Profile: http://www.excelforum.com/member.php...o&userid=27074
View this thread: http://www.excelforum.com/showthread...hreadid=465603