Consulting

Results 1 to 3 of 3

Thread: delete all the entries based on the user input

  1. #1
    VBAX Mentor
    Joined
    Sep 2007
    Posts
    405
    Location

    delete all the entries based on the user input

    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

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Just do it in Excel with the macro recorder on and using Autofilter, it will generate the code for you.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Mentor
    Joined
    Sep 2007
    Posts
    405
    Location
    I have used the below code to delete the values greater than 09/15/2012 but the results are not expected.

    [VBA]
    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

    [/VBA]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •