+ Reply to Thread
Results 1 to 10 of 10

Macro to push the results of all formulae on multiple worksheets to another workbook

  1. #1
    Registered User
    Join Date
    03-27-2014
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    5

    Macro to push the results of all formulae on multiple worksheets to another workbook

    I inherited a price list workbook made up of multiple worksheets (some 30 pages). Each year the new prices (including % increase) are calculated by a formula in the row below each price (100's of rows and formulae).
    Thus:
    C1 might say £10
    D1 says =C1+(C1*2.5%) £10.25 (it actually does some rounding too)
    etc
    It may seem odd having both rows but MD can see the before and after. The new price 10.25 must however be manually copied to C1 to avoid circular referencing and then D1 row hidden. Very laborious to repeat 100's of times.

    Is there a way of first copying the entire workbook for the new year (easy) then by means of a macro looping through each formula cell of all sheets in workbook 1 and pushing the result to the new workbook and to the correct sheet and then to the same location but to the cell above. e.g. pushing £10.25 from D1 of sheet 1 workbook 1 to C1 of sheet 1 workbook 2 to become the new price for the coming year?

    There may be entirely better way of managing price lists and it would be interesting to hear how others do it but it would be expedient if I could just get this variant working quickly for now. Thanks.

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Macro to push the results of all formulae on multiple worksheets to another workbook

    Please attach a workbook showing how your data is structured, some example data, and what your required outcome looks like.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Registered User
    Join Date
    03-27-2014
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Macro to push the results of all formulae on multiple worksheets to another workbook

    Hate to ask how to attach a file but I'm a forum rookie!

  4. #4
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Macro to push the results of all formulae on multiple worksheets to another workbook

    It's covered in The Rules
    Post a WORKBOOK. Nobody wants to type data from a picture or paste text from your post into a spreadsheet as a prelude to helping. To attach a file, push the button with the paperclip (or scroll down to the Manage Attachments button), browse to the required file, and then push the Upload button.

  5. #5
    Registered User
    Join Date
    03-27-2014
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    5

    Post Re: Macro to push the results of all formulae on multiple worksheets to another workbook

    thisyear.pnglastyear.pngWIDGETS.xlsx

    Please see mock-up workbook 3 pages only. In reality no of sheets variable. See from snapshots of page 1 that results fields of lastyear workbook become source fields for the new thisyear workbook. Same required for all sheets. Problem is I need a macro to do this automatically. To loop through all sheets of active workbook and take each formula result and push it to the same location but the cell above in the thisyear workbook so that it becomes the source cell for future calculations.

    Thank you so much.

  6. #6
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Macro to push the results of all formulae on multiple worksheets to another workbook

    Okay. Try:
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    03-27-2014
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Macro to push the results of all formulae on multiple worksheets to another workbook

    Quote Originally Posted by Olly View Post
    Okay. Try:
    Please Login or Register  to view this content.
    Thanks so much it works for Col C only on the currently active sheet without error, however for my purposes it has the following issues:
    1. It only works on Col C when in fact (sorry I didn't send a sheet to illustrate this) there can be a variable number of columns on the sheet containing prices/formulae e.g. B, or C, D, E, or F, H, J, L etc and not necessarily include C. Also variable no of formula rows, or even no prices at all on the intro sheets.
    2. This code updates Col C in the current sheet and I was envisaging it involving updating second workbook. But may be I rethink this can copy the Lastyear workbook and run the macro on the Thisyear workbook?
    3. Is there a way of ensuring the macro runs on all Price/Formula Cells for ALL sheets in the workbook automatically other than having to highlight and select all Sheets before running the macro. I am nervous that not all prices will be updated and that will cause havoc?
    Thank you so much though and I am grateful for your help thus far.

  8. #8
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Macro to push the results of all formulae on multiple worksheets to another workbook

    To deal with all columns, change the code to:
    Please Login or Register  to view this content.
    This will now work on all formula cells, not just column C.
    (Advice: state your requirement very clearly, as you will likely get exactly what you ask for!!)

    The code already works on ALL worksheets in the workbook (see that it loops through each worksheet in the workbook?)

    And yes, the easiest way is to make a copy of the workbook, THEN run the code. You could do this in code, if you needed to, but unless you are doing it many times, it's probably just as quick and easy to take a manual copy.

  9. #9
    Registered User
    Join Date
    03-27-2014
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Macro to push the results of all formulae on multiple worksheets to another workbook

    Thank you that is brilliant. Yes can see I wasn't clear on that no of cols is variable.
    Greatly appreciate your speed and helpfulness on this.

  10. #10
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Macro to push the results of all formulae on multiple worksheets to another workbook

    Great, thanks for the feedback.

    If your question is now answered, can you please mark this thread 'Solved'. You may also wish to add to the reputation of those who helped you, by clicking the small 'Add Reputation' star below their posts.

+ 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] V Look formulae to return multiple results in the same cell
    By n_kalpan@yahoo.com in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 11-09-2013, 03:30 AM
  2. Searching TEXT in formulae, rather than results of formulae
    By Niek Otten in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-06-2005, 06:05 AM
  3. [SOLVED] Searching TEXT in formulae, rather than results of formulae
    By AndyE in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 02:05 AM
  4. Searching TEXT in formulae, rather than results of formulae
    By AndyE in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 10:05 PM
  5. Searching TEXT in formulae, rather than results of formulae
    By AndyE in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-15-2005, 06:05 AM

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