+ Reply to Thread
Results 1 to 5 of 5

How to automatically remove blank rows in a table using macros

  1. #1
    Registered User
    Join Date
    11-05-2013
    Location
    Leeds
    MS-Off Ver
    Excel 2010
    Posts
    33

    How to automatically remove blank rows in a table using macros

    In VBA in excel, I want to know how I can automatically remove rows in my spreadsheet table where all the columns in the row are blank. For example If I have a table with four columns from A-D, if a row has all columns blank, then how can I remove it from the table automatically? Is this possible? At the moment nothing is happening with the code I attempted. I am using an MAC EXCEL 2011.

    Here is a link to a screenshot on what the table looks like and the code I attempted:

    http://www.dropviewer.com/v.php?i=527a411bb8242.png

    Here is the code:

    Please Login or Register  to view this content.
    Can somebody provide a sample code for this please?

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,890

    Re: How to automatically remove blank rows in a table using macros

    Try this code:

    Please Login or Register  to view this content.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    11-05-2013
    Location
    Leeds
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: How to automatically remove blank rows in a table using macros

    Hi, Ok I copied the code and assigned the macros but still not removing any blank rows. When I assign Macros and click run I just get an message saying 400. This could be the number of blank rows there are but it isn't removing any blank rows. I can't seem to find where you have compiled the range to check for each column but I don't know if that is just me.

    The formula I use to insert data automatically from worksheet "1st" into the "Cases" worksheet which you was seeing for each column is below: (sample row)

    Brands: =
    Please Login or Register  to view this content.
    Open Closed: =
    Please Login or Register  to view this content.
    Case Number: =
    Please Login or Register  to view this content.
    Case Summary: =
    Please Login or Register  to view this content.
    I will link you to the spreadsheet if a lot easier so you can see what is happening

  4. #4
    Registered User
    Join Date
    11-05-2013
    Location
    Leeds
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: How to automatically remove blank rows in a table using macros

    The attachment assumes that I only have 26 rows of data on each day tab in the Case tables. The Cases sheet is protected (not with a password) so you don't accidentally delete the many formulas in the B6 to E811 range. You can select the cells and see the formulas in them. Notice the gaps in data as you scroll down. I used the data from sheet '1st' for all of the Case tables on the others sheets. If you select the cells you can see how each section of 26 rows relates to each of the day pages.

    So in "1st Worksheet you can see the whole table is not full of data, there are blank rows, but it copies the blank rows into the "Cases" worksheet table anyway. I don't want these blank rows to appear in the "Cases" table, so I want to it to figure out that if there is a blank row, remove it from the "Cases" worksheet table.

    If I enter in data in the table in the "1st" worksheet, then the row should automatically appear in the "Cases" table worksheet. At the moment the data appears automatically due to filling in one of the blank rows but I don't want it like that

    http://ge.tt/8yUVdNx/v/0
    Last edited by carlbrooks; 11-06-2013 at 11:40 AM.

  5. #5
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,890

    Re: How to automatically remove blank rows in a table using macros

    Your issue is the rows are not blank. They contain formulas. In excel, blank means empty. Nothing in the cells. Suggest you change your formula to put an #N/A instead of the "" and then delete the rows based upon cells having #N/A in them.

    Your file did not convert properly for me to see everything as I am working on a Excel 2002 version this morning. You have some formula that are not compatible with 2002, but I can see that every cell has a formula in it.

    Alan

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] VBA to remove blank rows
    By kenadams378 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-19-2013, 10:11 AM
  2. Remove blank rows
    By chiragvaya in forum Excel General
    Replies: 6
    Last Post: 12-29-2012, 05:11 AM
  3. Remove blank rows
    By JohnsonBeGood in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 03-10-2011, 01:10 PM
  4. How to remove blank rows, then insert blank row conditionally, PLUS error proof
    By GTS115 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-05-2009, 11:39 AM
  5. [SOLVED] remove blank rows
    By [email protected] in forum Excel General
    Replies: 3
    Last Post: 02-20-2006, 11:45 AM

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