I would like to be able to exit the interior loop if the line " If TestVar <> "" Then" is equal to any value. I am receiving a compile error on this line
Is there some way I can exit the loop if TestVar comes back as not-nothing and then proceed within the outer loop?
Code:
Rows(bb).EntireRow.Delete Exit Do
Is there some way I can exit the loop if TestVar comes back as not-nothing and then proceed within the outer loop?
Code:
Dim bb As Integer: bb = Range("C5").End(xlDown).RowDim dd As Integer: dd = 1
Dim Spacer As Integer: Spacer = NumObs + 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[QUOTE][/QUOTE]
Loop
End If
bb = bb - 1
Loop