I am receiving the "Method Range of Object Global Failed" error on the line below.
I have "StartDate1" and "EndDate1" included in the watch window and both are showing date values as they should be.
I would like "Range1" to include a set of date values from StartDate1 to EndDate1. Is this the correct method to go about accomplishing something like this?
The line above exists within the context below:
Code:
Range1 = Range(StartDate1, EndDate1)
I have "StartDate1" and "EndDate1" included in the watch window and both are showing date values as they should be.
I would like "Range1" to include a set of date values from StartDate1 to EndDate1. Is this the correct method to go about accomplishing something like this?
The line above exists within the context below:
Code:
Dim bb As Integer: bb = Range("C5").End(xlDown).RowDim dd As Integer: dd = 1
Dim StartDate1 As Date
Dim EndDate1 As Date
Dim StartDate2 As Date
Dim EndDate2 As Date
Dim Range1 As Range
Dim Range2 As Range
Dim TestVar As Range
Do Until bb = 5
StartDate1 = Cells(bb, 4)
EndDate1 = Cells(bb, 5)
Range1 = Range(StartDate1, EndDate1)
Do Until bb - dd = 5
StartDate2 = Cells(bb - dd, 4)
EndDate2 = Cells(bb - dd, 5)
Range2 = Range(StartDate2, EndDate2)
TestVar = Application.Union(Range1, Range2)
If TestVar <> "" Then
Rows(bb).EntireRow.Delete
Exit Do
Else: dd = dd - 1
End If
Loop
bb = bb - 1
Loop