+ Reply to Thread
Results 1 to 4 of 4

delete record based on a value

  1. #1
    Anauna
    Guest

    delete record based on a value

    Hello,

    I would like to be able to delete all values greater than 60 on a
    spreadsheet.
    --
    Thank-you and all suggestions are appreciated.

  2. #2
    Jim Thomlinson
    Guest

    RE: delete record based on a value

    Why not just sort and delete?
    --
    HTH...

    Jim Thomlinson


    "Anauna" wrote:

    > Hello,
    >
    > I would like to be able to delete all values greater than 60 on a
    > spreadsheet.
    > --
    > Thank-you and all suggestions are appreciated.


  3. #3
    Ron de Bruin
    Guest

    Re: delete record based on a value

    Hi

    This example use AutoFilter to do this
    The first cell in the range is the header cell


    Sub Delete_with_Autofilter()
    Dim DeleteValue As String
    Dim rng As Range

    DeleteValue = ">60"

    With ActiveSheet
    .Range("A1:A100").AutoFilter Field:=1, Criteria1:=DeleteValue
    With ActiveSheet.AutoFilter.Range
    On Error Resume Next
    Set rng = .Offset(1, 0).Resize(.Rows.Count - 1, 1) _
    .SpecialCells(xlCellTypeVisible)
    On Error GoTo 0
    If Not rng Is Nothing Then rng.EntireRow.Delete

    End With
    .AutoFilterMode = False
    End With
    End Sub


    --
    Regards Ron de Bruin
    http://www.rondebruin.nl


    "Anauna" <[email protected]> wrote in message news:[email protected]...
    > Hello,
    >
    > I would like to be able to delete all values greater than 60 on a
    > spreadsheet.
    > --
    > Thank-you and all suggestions are appreciated.




  4. #4
    William Benson
    Guest

    Re: delete record based on a value

    Assuming you mean all values in a single column, then you should put on
    Autofilter and set the criterion to >=60, then delete results.

    If you need to look over every cell in the worksheet for values >=60, that's
    a different story.
    Sub DelValues()
    Dim c As Range

    For Each c In activeSheet.UsedRange
    If c.Value >= 60 And IsNumeric(c.Value) Then c.Delete
    Next 'c

    End Sub



    "Anauna" <[email protected]> wrote in message
    news:[email protected]...
    > Hello,
    >
    > I would like to be able to delete all values greater than 60 on a
    > spreadsheet.
    > --
    > Thank-you and all suggestions are appreciated.




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1