+ Reply to Thread
Results 1 to 6 of 6

Save Macro: filter adds an empty row

  1. #1
    Registered User
    Join Date
    11-29-2013
    Location
    Argentina
    MS-Off Ver
    Excel 2010
    Posts
    11

    Save Macro: filter adds an empty row

    Hello dear Excel community.

    First I want to thank the Excel forums for always being the first ones to send me an email for my Birthday. Usually I'm eagerly waiting for messages as soon as the clock hits 0:00, I tend to not receive any except for Excel community, so it's a great relief. Big thanks to whoever is taking the time to send me those messages.

    Anyways, I have an excel macro which converts my sheets to TXT format when I press a special key combination. These TXT files are data used by my Application.

    Please Login or Register  to view this content.
    However, when I have a Data->FILTER applied to my sheet, upon saving, Excel adds an extra blank line at the end of the TXT file. This causes my app to break in complete anger.
    I am curious how can I detect if the last line is empty, and remove if it is, when generating the TXT file.

    Very much appreciated. Thank you EXCEL COMMUNITY.

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Save Macro: filter adds an empty row

    Maybe you can turn off the filter before you save the book:


    Please Login or Register  to view this content.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Registered User
    Join Date
    11-29-2013
    Location
    Argentina
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Save Macro: filter adds an empty row

    Thank you very much for your response. Unfortunately, the filter is disabled but there's still an empty row at the end.

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Save Macro: filter adds an empty row

    Does that mean it wasn't the filter? The copy seems unusual, have you tried it without the copy?

  5. #5
    Registered User
    Join Date
    11-29-2013
    Location
    Argentina
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Save Macro: filter adds an empty row

    The reason to copy the current sheet to a new one is also because it's backed up (rather than backing up the entire book)

    When I do this
    Please Login or Register  to view this content.
    There is an extra row at the end. However, if I disable the filter *before* cloning the sheet, like this:

    Please Login or Register  to view this content.
    No extra row is added. So cloning a sheet with an active filter is what creates this extra row.


    If I were to do this approach (unlike removing last row when there is) would it be possible to turn the previous filter back on (only if there was a filter to begin with)?

    Thanks again for your time.

  6. #6
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Save Macro: filter adds an empty row

    But you just saved the workbook so why do you need a copy?

+ 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. How to create macro that adds value to cell and create save button.
    By Censored in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-01-2019, 12:25 PM
  2. [SOLVED] Copy Filtered data and stop macro when filter is empty
    By dobracik in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-06-2017, 12:18 PM
  3. [SOLVED] VBA code adds 2 empty invisible (But selectable) line in outlook mail..Need fix on this
    By mchilapur in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 08-20-2016, 01:37 AM
  4. Macro to save individual sheets if a cell is not empty.
    By MagicMan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-15-2016, 03:01 PM
  5. [SOLVED] Change macro to filter Zero not Empty cells
    By Viktor86HUN in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-23-2014, 10:00 AM
  6. Replies: 0
    Last Post: 12-22-2011, 03:42 PM
  7. Replies: 1
    Last Post: 04-08-2010, 05:16 PM

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