+ Reply to Thread
Results 1 to 3 of 3

VBA to copy worksheets based on index # and add subtotals at the bottom

  1. #1
    Registered User
    Join Date
    01-27-2021
    Location
    atlanta
    MS-Off Ver
    365 (Enterprise)
    Posts
    24

    VBA to copy worksheets based on index # and add subtotals at the bottom

    Hi, I have two separate questions. I have a VBA that basically copies and pastes values from a master excel file to a new workbook. The first question is basically how to copy these worksheets based on the position and not the worksheet name, since Array SheetNames1 can change every month.

    The other issue is that at the end of two of the worksheets named Forecast vs. Orders and KP-Machine, there is a subtotal row (SUBTOTAL(9,...)) that I do not want pasted as values, and the data range will change every day. Is there a code that can look through column B and find the word "SUBTOTAL", and calculate the formula in that row through columns S:BA?

    Below is my starting vba code:

    Please Login or Register  to view this content.
    Attached Images Attached Images

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,938

    Re: VBA to copy worksheets based on index # and add subtotals at the bottom

    To loop through by position:

    Please Login or Register  to view this content.
    Or, if the position can change relative to a specific sheet

    Please Login or Register  to view this content.
    To leave the SUBTOTAL row on two specific sheets:

    Please Login or Register  to view this content.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Registered User
    Join Date
    01-27-2021
    Location
    atlanta
    MS-Off Ver
    365 (Enterprise)
    Posts
    24

    Re: VBA to copy worksheets based on index # and add subtotals at the bottom

    Thanks Bernie!!! This worked great for our workbook!

+ 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] copy multiple tables to the bottom & increase, decrease based on spinbutton
    By abdo meghari in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-31-2021, 01:45 PM
  2. how to copy only new row(s) from one sheet to bottom of others based on criteria
    By Rita Bush in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-18-2019, 10:32 PM
  3. [SOLVED] Find subtotals for three separate items and place all subtotals at bottom of all the data
    By skylinekiller in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 08-09-2019, 09:22 AM
  4. Replies: 1
    Last Post: 11-22-2015, 08:35 AM
  5. Replies: 1
    Last Post: 04-29-2012, 01:03 PM
  6. Place all subtotals at bottom of pivot table?
    By Air_Cooled_Nut in forum Excel General
    Replies: 2
    Last Post: 07-13-2006, 06:58 PM
  7. Replies: 1
    Last Post: 06-20-2005, 07:05 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