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.
|