I have a piece of information, and I had some input in the form of columns of the start and end dates. What I want to do is say that if you are outside the limits of the selected date range, then delete the contents of the cells, 3 to the right and -4 to the left of each. therefore, -4 to the left of the start date and 3 to the right of the end date.
I started, but I had trouble deleting if you are not in my date range in cells
Private Sub cmdFilter_Click()
' Function to filter dates between text boxes, deletes all not in the range
Dim stStart As String, stEnd As String
Dim dbStart As Double, dbEnd As Double
Application.ScreenUpdating = 0
'Turn off screen updating until process done so it doesnt flicker
stStart = txtStart.Value
stEnd = txtEnd.Value
If Not IsDate(stStart) Or Not IsDate(stEnd) Then
MsgBox "Invalid Dates", vbExclamation, "Input Error"
GoTo ExitSub
End If
dbStart = CDbl(CDate(stStart))
dbEnd = CDbl(CDate(stEnd))
' change to highlight cell for time being
INSERT DELETE IF OUT OF RANGE HERE?
ExitSub:
Application.ScreenUpdating = 1
End Sub
early
source
share