LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Exclude date

Be sure you change the format for the whole columns (G & H) to custom -
dd/mm/yyyy.

To test, go to the bottom of your data in column G and enter a test date
26/02/2009, then select the auto fill feature (the lower right corner of the
cell - click and drag down) and drag down 10 or so cells, does it continue
with 27/02/2009, 28/02/2009, 01/03/2008, 02/03/2008 ..... If it does, you
got the format set correctly.

This code below works for me.

Sub CommandButton7_Click()
' highlight Col G & H, Format Cell - Custom - dd/mm/yyyy
Dim lngLastRow As Long
Dim i As Long
Dim Reeks1 As Variant
Dim Reeks2 As Variant
Reeks1 = InputBox("Start Date dd/mm/yyyy")
If Reeks1 = False Then Exit Sub
Reeks2 = InputBox("End Date dd/mm/yyyy")
If Reeks2 = False Then Exit Sub

lngLastRow = Sheets("Ruwe data").Cells(Rows.Count, "G").End(xlUp).Row

For i = lngLastRow To 2 Step -1
If Format(Cells(i, "G"), "dd/mm/yyyy") = Reeks1 And _
Format(Cells(i, "H"), "dd/mm/yyyy") < Reeks2 Then
Else
Rows(i).EntireRow.Delete Shift:=xlUp
End If
Next i

End Sub


"Basta1980" wrote:

Hi DataHog,

This 2 doesn't change the problem.


 
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
Date count to exclude weekends Colin Hayes Excel Worksheet Functions 0 January 20th 09 01:24 AM
Add days to a date, but exclude holidays Chickadee Excel Worksheet Functions 13 July 31st 08 04:22 PM
How do I Exclude a list of dates in a date calculation? Ryan Excel Worksheet Functions 2 June 11th 08 12:29 AM
Date Calculation to exclude weekends Vim Excel Worksheet Functions 2 January 24th 06 02:58 PM
Date exclude weekdays LukePW New Users to Excel 9 December 20th 04 05:00 PM


All times are GMT +1. The time now is 11:55 PM.

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"