Results 1 to 7 of 7

issues about deleting zero rows

Threaded View

  1. #1
    Registered User
    Join Date
    10-31-2014
    Location
    canada
    MS-Off Ver
    2007
    Posts
    64

    issues about deleting zero rows

    Hi,

    I need vba code to delete those entire rows with column F equal to zero. First I want to delete those rows that have zero in column F in "Section 1" (Rows 5 to Row 21), and then get the total in row "Section 1 Sub-total" after deleting. And then do the same thing for section 2 and section 3. I've developed code for deleting, but it works fine until row 11. I use debug.print to show the results I get for each run. Here are my results. The range has total 17 rows, so it gets 17 0, 16 0, 15, 0.....When it runs to row 15 (row 11 in my defined range), I get the result 11 175. This is the result based on entire sheet, not my defined range. Can anyone help on this? I've attached my file.

    17
    0
    16
    0
    15
    0
    14
    0
    13
    0
    12
    0
    11
    175
    10
    165

    Sub MPS_delete()
    
        ActiveSheet.Columns(6).Find(what:="Flat Fee", LookIn:=xlValues).Offset(2, 0).Select
        Set Rng = Range(ActiveCell, ActiveCell.End(xlDown))
    
        For j = Rng.Rows.Count To 1 Step -1
            Debug.Print j
            Debug.Print Cells(j, "F").Value
            If Cells(j, "F") = 0 Then
                Rows(j).Delete
            End If
    
        Next
    
    End Sub
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Inserting/Deleting Rows Causes Issues with Conditional Formatting Macro
    By lashellr in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-05-2014, 01:25 PM
  2. Replies: 2
    Last Post: 08-20-2013, 07:52 AM
  3. Changing code from deleting rows to cut/paste rows into another sheet and delete blank row
    By kmarshall6576 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-18-2013, 01:54 AM
  4. [SOLVED] Deleting part of a column without deleting whole rows.
    By dstrdOne in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-30-2013, 11:42 AM
  5. [SOLVED] Issues deleting a Row in VBA
    By bigman8424 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-27-2013, 12:46 AM
  6. VBA- deleting rows which contain cells that meet criteria, but skip alpha rows
    By cheapkid1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-30-2012, 08:49 AM
  7. Deleting colored text and formatting issues-
    By Biased Historian in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-10-2010, 09:33 AM

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