+ Reply to Thread
Results 1 to 18 of 18

Speed up code to backup file for more than 30 sheets

  1. #1
    Forum Contributor
    Join Date
    05-25-2022
    Location
    Asia
    MS-Off Ver
    2019
    Posts
    225

    Speed up code to backup file for more than 30 sheets

    Hi experts,
    I search to improve code speed when create backup from the file .
    the file contains about 30 sheets and will increase from time to another.
    I suspect slowness code will be from many sheets which contain file .
    Please Login or Register  to view this content.
    I truly appreciate if anybody improve this code to become more speed.

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Hi, try this ...


    Yes as obviously the size makes the time necessary so nothing to improve according to speed.
    The reason why using Excel like a database software is not such a great idea, could be 100 times slower …

    Anyway your code can be revamped as

    PHP Code: 
    Sub Demo1()
        
    Application.CopyObjectsWithCells False
        Sheets
    .Copy
        ActiveWorkbook
    .SaveAs "C:\Users\AANI\Desktop\ACCOUNTS\BALANCES MOVEMENT " Format(Now"yyyy-mm-dd hhmm "), 51
        ActiveWorkbook
    .Close
    End Sub 
    ► Do you like it ? ► So thanks to click on bottom left star icon « Add Reputation » !

  3. #3
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,212

    Re: Speed up code to backup file for more than 30 sheets

    A sample file might help

    your quick wins are
    To have no other workbooks open


    to turn off calculation Application.Calculation = xlCalculationManual
    turn off screen updating Application.screenupdating=False

    no idea if the below is quicker or slower
    Please Login or Register  to view this content.

  4. #4
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,237

    Re: Speed up code to backup file for more than 30 sheets

    Also...Instead of looping through the shapes on each ws to delete...just make use of 1 line...
    Please Login or Register  to view this content.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  5. #5
    Forum Contributor
    Join Date
    05-25-2022
    Location
    Asia
    MS-Off Ver
    2019
    Posts
    225

    Re: Speed up code to backup file for more than 30 sheets

    thanks guys , I thought there is better way , but all of your suggestion doesn't make difference , sorry!

  6. #6
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Speed up code to backup file for more than 30 sheets


    As I wrote …

    The 'better' way is to not use Excel but a database software.

  7. #7
    Forum Contributor
    Join Date
    05-25-2022
    Location
    Asia
    MS-Off Ver
    2019
    Posts
    225

    Re: Speed up code to backup file for more than 30 sheets

    I do not used to work with database software.
    and create codes by database software is really hard for me .
    I no know how start to enter guiding database software!

  8. #8
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Speed up code to backup file for more than 30 sheets


    So with Excel just do not complain about / expect speed as it needs more time …

  9. #9
    Forum Contributor
    Join Date
    05-25-2022
    Location
    Asia
    MS-Off Ver
    2019
    Posts
    225

    Re: Speed up code to backup file for more than 30 sheets

    So with Excel just do not complain
    I don't complain , just I post to see if it's possible as the rest of members when they ask to make speed their codes.

  10. #10
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Speed up code to backup file for more than 30 sheets


    Try post #2 …

  11. #11
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,527

    Re: Speed up code to backup file for more than 30 sheets

    Am I missing something? Can't you save the workbook under the new name and then delete all shapes, or whatever you want to do, in the new workbook?
    Experience trumps academics every day of the week and twice on Sunday.

  12. #12
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,237

    Re: Speed up code to backup file for more than 30 sheets

    Post 2 code takes less than a second with 30 sheets...so what is problem...

  13. #13
    Forum Contributor
    Join Date
    05-25-2022
    Location
    Asia
    MS-Off Ver
    2019
    Posts
    225

    Re: Speed up code to backup file for more than 30 sheets

    Try post #2 …
    I did it, but not really big difference

  14. #14
    Forum Contributor
    Join Date
    05-25-2022
    Location
    Asia
    MS-Off Ver
    2019
    Posts
    225

    Re: Speed up code to backup file for more than 30 sheets

    Am I missing something? Can't you save the workbook under the new name and then delete all shapes, or whatever you want to do, in the new workbook?
    delete all shapes takes more time for all of sheets . my goal save the files without any shape and as xlsx to send by email .

  15. #15
    Forum Contributor
    Join Date
    05-25-2022
    Location
    Asia
    MS-Off Ver
    2019
    Posts
    225

    Re: Speed up code to backup file for more than 30 sheets

    Post 2 code takes less than a second with 30 sheets...so what is problem...
    what about the original code, how many times takes?

  16. #16
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,237

    Re: Speed up code to backup file for more than 30 sheets

    what about the original code, how many times takes?
    just over a second...

  17. #17
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Speed up code to backup file for more than 30 sheets


    Quote Originally Posted by abdo M View Post
    I did it, but not really big difference
    You can also try to desactivate the ScreenUpdating during the process.
    As there is an unique way to save a new workbook
    so asking to « speed up » has no more chance than Poutine to receive the Nobel Peace Prize …

  18. #18
    Forum Contributor
    Join Date
    05-25-2022
    Location
    Asia
    MS-Off Ver
    2019
    Posts
    225

    Re: Speed up code to backup file for more than 30 sheets

    just over a second...
    thanks for confirmation .
    this means I have to adapt with the original code.

+ 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 Code to disable only specific macro when saving backup file
    By sintek in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-06-2016, 11:24 AM
  2. Speed up code, disable calculation on all sheets except active
    By Armitage2k in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-22-2015, 06:09 AM
  3. VBA Code to SaveAs file in one location, and backup to another location
    By honger in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-09-2014, 10:57 PM
  4. Speed up code that opens and pulls data from 30+ excel files and then closes file
    By chadwick140 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-06-2013, 09:58 AM
  5. Replies: 6
    Last Post: 03-07-2012, 04:56 PM
  6. Saving backup file on file open
    By AmyTaylor in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-10-2006, 10:48 AM
  7. [SOLVED] Backup:always create a backup file in the save options
    By Alek in forum Excel General
    Replies: 1
    Last Post: 01-07-2006, 09:25 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