PC Review


Reply
Thread Tools Rate Thread

Dats in If statement

 
 
=?Utf-8?B?SmFub3M=?=
Guest
Posts: n/a
 
      26th Apr 2007
just a quick one, I am trying to count stuff within a month, This If
statement counts if it is an April date:

If r1.Value > "1/4/2007" And r1.Value < "31/04/2007" Then
counter = counter + 1
Address2 = r1.Offset(1, 0).Address(ReferenceStyle:=xlR1C1)
End If

This works fine, but:

If r1.Value > "1/5/2007" And r1.Value < "31/05/2007" Then
counter = counter + 1
Address2 = r1.Offset(1, 0).Address(ReferenceStyle:=xlR1C1)
End If

Lets through all sort of dates... including june and what not...

Am i going blind? or just plainly stupid? What am idoing wrong?

Thank you all!

Janos
 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      26th Apr 2007
Play safe

If r1.Value > DateSerial(2007,5,1) And r1.Value < DaterSerial (2007,6,1)

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Janos" <(E-Mail Removed)> wrote in message
news:90891123-249D-4F3B-A121-(E-Mail Removed)...
> just a quick one, I am trying to count stuff within a month, This If
> statement counts if it is an April date:
>
> If r1.Value > "1/4/2007" And r1.Value < "31/04/2007" Then
> counter = counter + 1
> Address2 = r1.Offset(1, 0).Address(ReferenceStyle:=xlR1C1)
> End If
>
> This works fine, but:
>
> If r1.Value > "1/5/2007" And r1.Value < "31/05/2007" Then
> counter = counter + 1
> Address2 = r1.Offset(1, 0).Address(ReferenceStyle:=xlR1C1)
> End If
>
> Lets through all sort of dates... including june and what not...
>
> Am i going blind? or just plainly stupid? What am idoing wrong?
>
> Thank you all!
>
> Janos



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Attachments and Winmail.dats =?Utf-8?B?RWxhaW5lIFJvd2xleQ==?= Microsoft Outlook Discussion 1 17th Nov 2004 05:20 PM
Internet Explorer and index.dats =?Utf-8?B?TGV4dXM=?= Windows XP Help 1 4th Nov 2004 10:58 PM
Dats exectuion Bob Windows XP General 1 2nd Oct 2004 04:15 PM
Using two extra.dats in McAfee? Juergen Nieveler Anti-Virus 3 7th Apr 2004 02:11 PM
Dats Errors Roger F Swinderman Microsoft Excel Misc 0 10th Nov 2003 01:57 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:00 AM.