+ Reply to Thread
Results 1 to 8 of 8

delete blank rows in multiple worksheets

  1. #1
    Registered User
    Join Date
    02-08-2010
    Location
    Kent
    MS-Off Ver
    Excel 2007
    Posts
    10

    delete blank rows in multiple worksheets

    I want to delete all blank rows in all worksheets, have found the following code but this only deletes the selected data on the active worksheet. Any suggestions would be very gratefully received. Thanks

    Please Login or Register  to view this content.
    Last edited by vlady; 10-03-2012 at 03:54 AM. Reason: Code tags

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: delete blank rows in multiple worksheets

    this macro checks only column A for empty cells and delete entire rows
    Please Login or Register  to view this content.
    If solved remember to mark Thread as solved

  3. #3
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: delete blank rows in multiple worksheets

    Hi, patel45,

    the macro will only search Column A of the ActiveSheet while you augment the counter (exactly the line you commented is necessary for your example). Please mind that Sheets.Count includes Charts and Macro Sheets as well while Worksheets.Count will only include Worksheets where the code would be useful.

    @pacman76:
    please use Code-Tags for displaying as per Rule #3 demanded
    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  4. #4
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: delete blank rows in multiple worksheets

    Quote Originally Posted by HaHoBe View Post
    Hi, patel45,
    the macro will only search Column A of the ActiveSheet while you augment the counter (exactly the line you commented is necessary for your example).
    Thanks for advise, your solution is better, but why did you insert
    Please Login or Register  to view this content.
    ?
    this does not work on my test

  5. #5
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: delete blank rows in multiple worksheets

    Hi, patel45,

    a mixture of codes that simply should throw up an exception and should have been worked over in the message window before answering (slipped through sadly enough). Code should read like

    Please Login or Register  to view this content.
    Ciao,
    Holger

  6. #6
    Registered User
    Join Date
    02-08-2010
    Location
    Kent
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: delete blank rows in multiple worksheets

    Hi,
    Thanks for the help however I can't seem to get this working. Have tried to run the macro but it doesn't seem to do anything. Am I missing something here? Do I need to alter the code in any way?

  7. #7
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: delete blank rows in multiple worksheets

    Hi, pacman76,

    I can't seem to get this working.
    Where did you put the macro? According to the use of ThisWorkbook it should only work from within the workbook with the code. If it is in say the personl.xls ThisWorkbook should be replaced with ActiveWorkbook.

    If you canīt get it to go with this change please attach a sample of the workbook to have a look at it - the last code provided worked fine in my sample workbook.

    Ciao,
    Holger

  8. #8
    Registered User
    Join Date
    02-08-2010
    Location
    Kent
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: delete blank rows in multiple worksheets

    Wonderful, this works perfectly. Thank you so much for your help

+ 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