Results 1 to 13 of 13

Removing Blank Lines in Range(s) on Opening Workbook - Code Broken

Threaded View

PippiLaRue Removing Blank Lines in... 03-13-2013, 03:31 AM
patel45 Re: Removing Blank Lines in... 03-13-2013, 03:53 AM
PippiLaRue Re: Removing Blank Lines in... 03-13-2013, 04:00 AM
patel45 Re: Removing Blank Lines in... 03-13-2013, 04:03 AM
HaHoBe Re: Removing Blank Lines in... 03-13-2013, 04:08 AM
PippiLaRue Re: Removing Blank Lines in... 03-13-2013, 04:10 AM
PippiLaRue Re: Removing Blank Lines in... 03-13-2013, 04:16 AM
HaHoBe Re: Removing Blank Lines in... 03-13-2013, 04:28 AM
  1. #1
    Registered User
    Join Date
    03-06-2013
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    31

    Removing Blank Lines in Range(s) on Opening Workbook - Code Broken

    Hi,

    I'm trying to remove empty lines in my table so that nothing is left blank in the report. My table is outlined, but the cells are blank. I've tried a different code, but it only allows me to remove lines that aren't outlined.
    I need to do this within a range on my sheet. Namely: A24:I26, A28:I33, A38:42. I also want to have this activated as soon as the workbook is open.

    I've currently got the code as listed below and it doesn't work, nor does it work for deleting just the range expressed (I'm guessing because the cells aren't populated, but the row isn't exactly blank as it has been outlined within the table)

    What am I doing wrong??

    NB: When I say Blank lines - I mean the cells in the columns A - I aren't populated with data.



     Private Sub Workbook_Open()
    
    Run "delblankrows"
    
    
    End Sub
    
    
    Option Explicit
    
    Sub delblankrows()
        
        Dim rngToCheck As Range, rowToCheck As Range
        Dim iRow As Integer
        Set rngToCheck = ActiveSheet.Range("A24:I32")
            For iRow = rngToCheck.rows.Count To 1 Step -1
            Set rowToCheck = rngToCheck.rows(iRow)
            If Application.CountA(rowToCheck) = "" Then
                rowToCheck.EntireRow.Delete
            End If
        Next iRow
     End Sub
    Last edited by PippiLaRue; 03-13-2013 at 04:10 AM.

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