+ Reply to Thread
Results 1 to 8 of 8

VBA - Change Cell Value to Next in a List, Save Sheet as PDF, Repeat

  1. #1
    Registered User
    Join Date
    12-14-2020
    Location
    Virginia
    MS-Off Ver
    MS 365
    Posts
    12

    VBA - Change Cell Value to Next in a List, Save Sheet as PDF, Repeat

    Hello - I need a macro that saves a sheet to PDF, then changes a cell value to the next name on a list to run the analysis for that name, then prints the sheet again to a separate PDF, and repeats until it has run through all the names. I've been looking but haven't found exactly what I'm looking for.

    For example, let's say I have 2 sheets, 'Output' and 'Data'. The Data tab contains sales and other info for 10 locations. The Output pulls in data from the Data tab for whichever location name is entered into cell A1 and then runs an analysis. I need a macro that generates a PDF of the Output sheet, then changes cell A1 for the next location, recalculates, saves another PDF, and repeats until a report has been saved for each location.

    Filepath: Cell A2 (Output)
    Filename: Cell A3 (Output)
    List of Locations: K2:K (Output)

    Thank you!!

    Note: I've also posted this question on Mr Excel (I didn't know this wasn't allowed, didn't know which forum was most active): Can't post link so this is the thread threads/vba-change-cell-value-to-next-in-a-list-save-sheet-as-pdf-repeat.1158600/
    Last edited by budfox310; 01-15-2021 at 04:21 PM. Reason: Cross-post link

  2. #2
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: VBA - Change Cell Value to Next in a List, Save Sheet as PDF, Repeat

    I don't think there is enough information to create your macro. Follow instructions in the yellow banner above to provide a sample file. For instance, how and what will cell A1 change?

  3. #3
    Registered User
    Join Date
    12-14-2020
    Location
    Virginia
    MS-Off Ver
    MS 365
    Posts
    12

    Re: VBA - Change Cell Value to Next in a List, Save Sheet as PDF, Repeat

    Quick conceptual example attached. A1 determines which location's sales get pulling in from the Data tab and displayed on the output tab. So instead of having to manually enter in each location #, saving it as a PDF, and then doing the same for the next location, I'm trying to create a macro.
    Attached Files Attached Files
    Last edited by budfox310; 01-15-2021 at 02:53 PM. Reason: Changed Attachment

  4. #4
    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,197

    Re: VBA - Change Cell Value to Next in a List, Save Sheet as PDF, Repeat

    Hi, budfox310


    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however it has been brought to our attention that the same query has been posted on one or more other forums and you have not provided the required cross-post link(s) here.

    Please see Forum Rule #3 about cross-posting and adjust accordingly. Read this to understand why we (and other sites like us) consider this to be important.

    (Note: this requirement is not optional. No help to be offered until the link is provided.)
    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

  5. #5
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: VBA - Change Cell Value to Next in a List, Save Sheet as PDF, Repeat

    Removed until OP follows admin request

  6. #6
    Registered User
    Join Date
    12-14-2020
    Location
    Virginia
    MS-Off Ver
    MS 365
    Posts
    12

    Re: VBA - Change Cell Value to Next in a List, Save Sheet as PDF, Repeat

    Hi, I have made the changes.

  7. #7
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: VBA - Change Cell Value to Next in a List, Save Sheet as PDF, Repeat

    Try this code

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by maniacb; 01-17-2021 at 05:36 PM. Reason: Add file

  8. #8
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,029

    Re: VBA - Change Cell Value to Next in a List, Save Sheet as PDF, Repeat


+ 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] Macro that will print/save as PDF with file name a cell, replace cell and repeat
    By JasonNeedsHelp in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-04-2018, 04:59 PM
  2. Excel doesn't change the cell format on save through the workbook save button
    By mitko1994 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-16-2017, 03:09 PM
  3. How to change the Combobox list and save that to a excel sheet each time
    By vijayanand.b in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-15-2016, 03:49 AM
  4. Repeat code in the same sheet for a different list
    By pkellogg in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 04-08-2015, 09:25 AM
  5. Replies: 17
    Last Post: 06-09-2013, 09:43 AM
  6. Change cell value that has data validation from list in a separate sheet with macro?
    By jimmyjackjoejames in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-28-2013, 11:31 AM
  7. [SOLVED] Change cell contents if found in a list on another sheet
    By fastcar in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 09-05-2012, 08:29 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