View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
STEVE BELL STEVE BELL is offline
external usenet poster
 
Posts: 692
Default Automatically Hightlight Rows with w/Date Check?

add

Dim x As Integer

x = InputBox("enter number")

Cells.Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=NOW()-$P1<" & x
With Selection.FormatConditions(1).Interior
.ColorIndex = 37
.Pattern = xlSolid
End With


or
Dim x As Integer, rw As Long, col As Long

rw = Selection.Row
col = Selection.Column

x = WorksheetFunction.Count(Range(Cells(rw, 1), Cells(rw, col)))
--
steveB

Remove "AYN" from email to respond
"Al Franz" wrote in message
...
Steve,

Thanks a lot, I took your advice and recorded a macro. The following is
what the code looked like. Is there an easy way to make the value of "8"
I coded in below a variable, so when I run the macro Excel would prompt me
for a value (i.e. number of days back to highlight)?

Cells.Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=NOW()-$P1<8"
With Selection.FormatConditions(1).Interior
.ColorIndex = 37
.Pattern = xlSolid
End With