Thread: Dates
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 1,726
Default Dates

Const limitDOWN As Date = #1/1/2007#
Const limitUP As Date = #2/2/2007#
Dim c As Range
For Each c In Worksheets("Instructions").Range("B7:B200").Cells
If c.Value limitDOWN & c.Value < limitUP Then
With c.Font
.Bold = True
.Italic = True
End With
End If
Next c


--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"Janos" wrote in message
...
Hello,

Sorry for the silly/basic question, but how can I compare dates? And would
I
be able to see if my cell is in a range of dates? I have this code that
doesn't work:

Const limitDOWN As Date = 1 / 1 / 2007
Const limitUP As Date = 2 / 2 / 2007
For Each c In Worksheets("Instructions").Range("B7:B200").Cells
If c.Date limitDOWN & c.Date < limitUPThen
With c.Font
.Bold = True
.Italic = True
End With
End If
Next c

Where is my Error?