Input box for date...then delete

I hope this is not too much to ask?
I need a input box for a macro that will STOP the macro and ask for a date...then delete that date and any date les than.  (Is less than or equal to)
The date column K.
Who is Participating?
byundtConnect With a Mentor Commented:
Here is a macro that will delete your data (entire rows) if column K date is on or before a user-specified value:

Sub DeleteDates()
Dim dat As Date
Dim rg As Range
Dim i As Long
dat = Application.InputBox("Please pick the latest date to be deleted", Type:=1)
If dat = 0 Then Exit Sub
Application.ScreenUpdating = False
Set rg = [K2]       'First date to examine
Set rg = Range(rg, Cells(Rows.Count, rg.Column).End(xlUp))
For i = rg.Rows.Count To 1 Step -1
    If rg.Cells(i,1) <> "" Then       'To delete rows with blanks also, then delete this statement and the End If
        If rg.Cells(i, 1) <= dat Then rg.Rows(i).EntireRow.Delete
    End If
Application.ScreenUpdating = True
End Sub

Use an InputBox, like this:

    Dim sDate As String
    sDate = InputBox("Please provide date")

    If IsDate(sDate) = True Then
        MsgBox sDate
    End If

eureka15Author Commented:
That is so KOOOL
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.