+ Reply to Thread
Results 1 to 4 of 4

Macro Reset error

  1. #1
    Registered User
    Join Date
    07-24-2007
    Location
    London, England
    MS-Off Ver
    Office 365 ProPlus
    Posts
    80

    Macro Reset error

    The enclosed file 'Performance Data Dump - old' contains a months worth of data which is added to on a daily basis and sorted and filtered into the 'Lettered' tabs, using Macro 'FormatFilterSortAndPasteToSheet'. I now want to start a new month, so thought the following would work. I saved the existing spreadsheet as a new file Performance Data Dump - 1 day. (also enclosed). I run the Macro 'ClearSheetsNotData' which empties the data under the 'Lettered' tabs. I deleted all the data under the 'Data' tab. I have now populated the first days worth of information into the 'Data' tab. The problem is when I now run the Macro 'FormatFilterSortAndPasteToSheet' it stops with an error. Can someone please let me know what I've done wrong. Thanks Kevin (in the UK using Excel 2002 SP3)
    Attached Files Attached Files
    Last edited by rushdenx1; 06-30-2010 at 05:23 AM.

  2. #2
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: Macro Reset error

    Hi Kevin;

    When I wrote the macro, I failed to take into account that there might be no data in sheet("B"). When there is not Data in "B" then iLastColumn remains 0 and crashes the .AutoFit line.
    So find this section
    Please Login or Register  to view this content.
    add the line that clears the sheet (this will make it unnecessary to run "ClearSheetsNotData" every month)
    also add the test to see if there is no data.
    Please Login or Register  to view this content.
    Last edited by foxguy; 06-28-2010 at 10:30 AM.
    Foxguy

    Remember to mark your questions [Solved] and rate the answer(s)
    Forum Rules are Here

  3. #3
    Registered User
    Join Date
    07-24-2007
    Location
    London, England
    MS-Off Ver
    Office 365 ProPlus
    Posts
    80

    Re: Macro Reset error

    Foxguy, thanks for your quick response. I have added the line to the new file enclosed. However when I run the Macro 'FormatFilterSortAndPasteToSheet'. It still Stops. When I close down the debugger, the DATA sheet is now grey apart from the headings. The original data has disappeared and you cannot add anything due to the 'grey'. Kevin.
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: Macro Reset error

    Hi Kevin;

    Sorry about that, I said I didn't have time. I guess I should have waited until I had the time to test it.
    Here's a file with better error trapping, so if an error occurs again it won't leave your "Data" still filtered (that's why it was gray). Copy of Performance Data Dump Ver 2.zip
    Had to zip it because it was too big.

    You might try reducing the size of the file by:
    Please Login or Register  to view this content.
    This should reduce the size of your file (hopefully)

+ 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