+ Reply to Thread
Results 1 to 7 of 7

Deleting rows

  1. #1
    Forum Contributor
    Join Date
    01-19-2006
    Posts
    142

    Deleting rows

    Hi all,

    Trying to loop through entire woorksheet and then based on cell criteria (empty or not) delete the entire row. I have the following implemented....but dows not work;

    Please Login or Register  to view this content.
    Any tips or feedback welcome! Thanks

  2. #2
    Norman Jones
    Guest

    Re: Deleting rows

    Hi GTI,

    Try:

    '=============>>
    Public Sub Tester()
    On Error Resume Next
    ActiveSheet.Columns(1). _
    SpecialCells(xlBlanks).EntireRow.Delete
    On Error GoTo 0
    End Sub
    '<<=============


    ---
    Regards,
    Norman


    "gti_jobert" <[email protected]> wrote
    in message news:[email protected]...
    >
    > Hi all,
    >
    > Trying to loop through entire woorksheet and then based on cell
    > criteria (empty or not) delete the entire row. I have the following
    > implemented....but dows not work;
    >
    >
    > Code:
    > --------------------
    >
    > Private Sub cmdFilter_Click()
    >
    > 'Copy Data Sheet & Paste Data onto a New Sheet
    > Cells.Select
    > Selection.Copy
    > Worksheets.Add
    > ActiveSheet.Paste
    > ActiveSheet.Rows(1).Select
    > Selection.Delete
    >
    > 'Delete rows that are not needed
    > strMySheet = ActiveSheet.Name
    > Sheets(strMySheet).Select
    >
    >
    > Sheets(strMySheet).Cells(1, 1).Select
    >
    > i = 1
    > Do
    > If (Cells(i, 4).Value = "") And (Cells(i, 5).Value <> "") Then
    > Sheets(strMySheet).Cells(i, 1).Select
    > Selection.EntireRow.Delete
    > End If
    > i = i + 1
    > Loop Until (Sheets(strMySheet).Cells(i, 1).Value <> "")
    >
    > End Sub
    >
    > --------------------
    >
    >
    > Any tips or feedback welcome! Thanks
    >
    >
    > --
    > gti_jobert
    > ------------------------------------------------------------------------
    > gti_jobert's Profile:
    > http://www.excelforum.com/member.php...o&userid=30634
    > View this thread: http://www.excelforum.com/showthread...hreadid=517729
    >




  3. #3
    Forum Contributor
    Join Date
    01-19-2006
    Posts
    142
    Hi,

    that would work, but i need to base it other cirteria as well - not just the cells i suggested in my first post.

  4. #4
    Bob Phillips
    Guest

    Re: Deleting rows

    Then give all the details.

    --
    HTH

    Bob Phillips

    (remove nothere from email address if mailing direct)

    "gti_jobert" <[email protected]> wrote
    in message news:[email protected]...
    >
    > Hi,
    >
    > that would work, but i need to base it other cirteria as well - not
    > just the cells i suggested in my first post.
    >
    >
    > --
    > gti_jobert
    > ------------------------------------------------------------------------
    > gti_jobert's Profile:

    http://www.excelforum.com/member.php...o&userid=30634
    > View this thread: http://www.excelforum.com/showthread...hreadid=517729
    >




  5. #5
    Forum Contributor
    Join Date
    01-19-2006
    Posts
    142
    Hello,

    I have a sheet containing masses of data. I want all rows to be deleted IF (Col 4 isnull And Col 5 isNotNull And Col 9 isnull And Col 10 isNotNull)

    I hope this helps.....I have been trying a few variations of code but dont seem to understand what its doing;

    Please Login or Register  to view this content.
    The above is just an example based on one Col criteria - and doesn't even delete those rows

  6. #6
    Forum Contributor
    Join Date
    01-19-2006
    Posts
    142
    I think I have sorted it now bob...did the following;

    Please Login or Register  to view this content.

  7. #7
    ers
    Guest

    Re: Deleting rows

    Hi all,
    I have no experience whatsoever with VBA. Can you please tell me what
    will be the code to delete all rows which do not have numerical values
    in the cells in first column (the ones I want to get rid of are either
    empty or contain text)?
    Thank you,
    emil


+ 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