Results 1 to 2 of 2

Delete rows in a selection?

Threaded View

  1. #1
    Registered User
    Join Date
    07-07-2010
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    2

    Delete rows in a selection?

    I'm new to the forum and I have used a lot of great ideas from a lot of the great users on the forum. I know that somone will be able to help me out on this as I have seen alot of what I call complex macros in the forum. So here is my question.

    How do I delete rows with a cell value of "0" in a selection I have selected in Excel? I have tried this macro which is I have tweaked from a previous macro that was used to hide "0" in a selection, but it will only delete half of the "0" that I have selected. Here is the macro, can someone please help?

    Thank you!!!



    Sub H_DeleteRow()
    
        With Application
            CalcMode = .Calculation
            .Calculation = xlCalculationManual
            .ScreenUpdating = False
        End With
        
        ActiveSheet.Unprotect
    
        Dim rng As Range, Cell As Range
    
        Set rng = Selection
    
        rng.EntireRow.Hidden = False
        For Each Cell In rng
        If Cell.Value = "0" Then Cell.EntireRow.Delete
    
        Next Cell
    
        With Application
            .Calculation = CalcMode
        End With
    
    
    End Sub
    Last edited by scottkrise05; 07-08-2010 at 08:50 PM. Reason: Added code tags

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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