PDA

View Full Version : delete all the entries based on the user input



sindhuja
09-13-2012, 05:24 AM
I need to delete all the entries based on the user input

First i need to format the column as "mm/dd/yyyy"

for ex, if the user provides the input as 09/15/2011 then i need to delete all the rows if a column H matches the criteria.

>09/15/2011

Can this be done using vba. can i get assistance

-Sindhuja

Bob Phillips
09-13-2012, 05:50 AM
Just do it in Excel with the macro recorder on and using Autofilter, it will generate the code for you.

sindhuja
09-14-2012, 08:29 AM
I have used the below code to delete the values greater than 09/15/2012 but the results are not expected.


Dim startdate As Date
Dim mystartdate As Long

startdate = InputBox("Enter the start date of your date range in mm/dd/yyyy format")
mystartdate = Format(startdate, "mm/dd/yyyy")
MsgBox startdate
myendrow = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row
My_Range.AutoFilter Field:=8, Criteria1:=">" & startdate, Operator:=xlFilterValues