Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Dats in If statement

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Dats in If statement

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" wrote in message
...
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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
IF statement inside a SUMIF statement.... or alternative method Sungibungi Excel Worksheet Functions 3 December 4th 09 06:22 PM
Reconcile Bank statement & Credit card statement & accounting data Bklynhyc Excel Worksheet Functions 0 October 7th 09 09:07 PM
Linking dats on a worksheet to control panel sbearman Charts and Charting in Excel 0 June 25th 08 01:35 PM
Working day(s)/Time between two dats (No Weekend or Holidays) B~O~B Excel Worksheet Functions 0 May 15th 08 06:32 PM
How to add cells yet neglecting alphabet dats perfection Excel Discussion (Misc queries) 3 April 11th 08 09:47 PM


All times are GMT +1. The time now is 02:33 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"