+ Reply to Thread
Results 1 to 11 of 11

Loop to save all versions of report using drop down

  1. #1
    Registered User
    Join Date
    11-18-2016
    Location
    Denver, Colorado
    MS-Off Ver
    2013 64-bit
    Posts
    5

    Unhappy Loop to save all versions of report using drop down

    Hello and thank you for any help I can get with this!

    I am trying to use the following Macro to save all versions of a report, but I don't know how to create the loop. The reports value change based off of a drop down cell and I want to save every version of that drop down to a designated folder. My current Marco is causing the saved files to crash excel and I am not sure why.

    My drop down is in cell C2 and it is the data validation is based on O16:O159

    I am copy and pasting several tabs to a new worksheet because I need to save the report as values since I am currently using a cube connection that is not accessible by the end user.

    Any help on this would be greatly appreciated!

    This is the current Macro I am using:

    Please Login or Register  to view this content.
    Last edited by paul_cyr; 11-18-2016 at 03:21 PM.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Loop to save all versions of report using drop down

    Hi and welcome to the forum.

    1.) You need to edit your post and add CODE tags around your VBA code. It's a forum rule, and others are adamant about enforcing it.

    2.) "My current Marco is causing the saved files to crash excel"
    Can you better explain exactly what happens? It can help diagnose the issue. If the code errors, what is the error description and what line of code is highlighted when you click the Debug button on the error dialog?

    3.) Delete the two Call commands.
    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    11-18-2016
    Location
    Denver, Colorado
    MS-Off Ver
    2013 64-bit
    Posts
    5

    Re: Loop to save all versions of report using drop down

    Hi AlphaFrog,

    1)Thanks for the forum rules info, this is my first post so I was not sure how to add the CODE tags.

    2) After the file is saved via the Macro, when is it reopen and you try to save it, Excel crashes. There is no error given to explain why it is crashing.

    3) When I remove the Call from the 'Call .Range' line I get 'Complile error: Expected: ='

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Loop to save all versions of report using drop down

    2.) Describe "crash". What do you see; Does it lockup, does it exit excel?

    3.) Remove the parenthesis
    .Range("a1").PasteSpecial(Paste:=xlValues)

  5. #5
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Loop to save all versions of report using drop down

    Try this (not tested).

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    11-18-2016
    Location
    Denver, Colorado
    MS-Off Ver
    2013 64-bit
    Posts
    5

    Re: Loop to save all versions of report using drop down

    AlphaFrog you are a live saver!!!! THANK YOU SO MUCH!

    Would you also be able to help me out with looping through the drop down and saving each version of this report?

    Thanks again!

  7. #7
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Loop to save all versions of report using drop down

    That actually worked?

    Need to step away for a while. I'll take a look at looping in a couple of hours.

  8. #8
    Registered User
    Join Date
    11-18-2016
    Location
    Denver, Colorado
    MS-Off Ver
    2013 64-bit
    Posts
    5

    Re: Loop to save all versions of report using drop down

    Yes, it did! Not sure why but I can't complain. That would be great if you could take a look at looping it, I have been searching for a while and could not find an answer that worked.

  9. #9
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Loop to save all versions of report using drop down

    The code (both old and new) doesn't use the value in the C2 DV list. So what changes in the code for the loop?

    What file name do you want to save each version in the loop?

  10. #10
    Registered User
    Join Date
    11-18-2016
    Location
    Denver, Colorado
    MS-Off Ver
    2013 64-bit
    Posts
    5

    Re: Loop to save all versions of report using drop down

    Hey AlphaFrog,

    I am currently saving each file individually.

    I have a drop down list in C2 on my 'Config' tab that is based off of O17:O159, I want the macro to go to the next number in the drop down and save the report to the location listed below, the file name will change based off of cell B1 on the new excel worksheet that is created.

    Thanks again for all your help!

    Please Login or Register  to view this content.

  11. #11
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Loop to save all versions of report using drop down

    Please Login or Register  to view this content.

+ 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. VBA to Open Monarch10 and run Model > Report and save final report : Please Assist
    By naresh73 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-08-2016, 04:23 AM
  2. Drop-down lists in older versions of Excel
    By nclark52 in forum Excel General
    Replies: 1
    Last Post: 09-29-2015, 05:52 PM
  3. Replies: 0
    Last Post: 07-27-2015, 01:06 PM
  4. Replies: 1
    Last Post: 09-05-2013, 02:39 PM
  5. Save 15 File versions by changing one value
    By Junebug3 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-21-2013, 05:43 AM
  6. how to save different versions
    By sharc in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-02-2008, 04:20 PM
  7. Save As csv file between Excel versions
    By EdwardH in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-25-2005, 01:06 PM

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