View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
shaz0503 shaz0503 is offline
external usenet poster
 
Posts: 9
Default Date ranges in VBA

All

Have borrowed some really useful code for calculating the number of emails
in a specific mail folder...

However, the code uses a single date - I would like to use a range
identified in two cells eg Date one - Sheet 1 A1 and Date two Sheet 1 A2

Below is the code and I am at a loss as to how to update this


Dim iCount As Integer, DateCount As Integer
Dim myDate As Date
EmailCount = objFolder.Items.Count
DateCount = 0
myDate = Sheets("Sheet1").Range("A1").Value

For iCount = 1 To EmailCount
With objFolder.Items(iCount)
If DateSerial(Year(.ReceivedTime), Month(.ReceivedTime),
Day(.ReceivedTime)) = myDate Then DateCount = DateCount + 1
End With
Next iCount

any assistance would be greatly appreciated

Shaz