+ Reply to Thread
Results 1 to 3 of 3

Create formulas in new workbook where number of worksheets in new workbook varies

  1. #1
    Registered User
    Join Date
    02-26-2015
    Location
    Weymouth, Dorset
    MS-Off Ver
    2007
    Posts
    14

    Create formulas in new workbook where number of worksheets in new workbook varies

    Hi - I have a problem with a VBA project that I've been unable to solve on my own. I'm not sure if it's even possible to do what I want to do, but I'm hoping somebody here can help me.

    I have a workbook which is used as a hub to aggregate data in a number of other workbooks. These other workbooks are generated by the hub workbook, however each of the child workbooks relates to a real world family (one worksheet for each family member), and as we know families vary in size.

    On the child workbook there is an additional sheet which sums the values on each of the family members's sheets (ie Sheet1!A1 + Sheet2!A1 + Sheet3!A1 + Sheet4!A!...etc) for each of the values (there are over 200 per person), but as the family size varies, I need the sum to vary for each workbook, to ensure that (a) I am capturing each of the family members and (b) I'm not trying to add non-existent worksheets to the calculation.

    Is there any way of doing this? The size of the family is a global variable entered in an InputBox by the end user - I am hoping that there may be some way I can use that value for the formulas (in a for...next loop perhaps), but I have reached the end of my knowledge!

    Any help much appreciated.

  2. #2
    Registered User
    Join Date
    06-12-2009
    Location
    Chester, NY
    MS-Off Ver
    Excel 2013
    Posts
    89

    Re: Create formulas in new workbook where number of worksheets in new workbook varies

    Do you have a sample workbook we can see?

  3. #3
    Registered User
    Join Date
    02-26-2015
    Location
    Weymouth, Dorset
    MS-Off Ver
    2007
    Posts
    14

    Re: Create formulas in new workbook where number of worksheets in new workbook varies

    Hi

    Thanks for the reply. I have attached a Sample Workbook (I hope I've done it right!), and below is the code that creates the workbook at present... (MemberCount is my variable for the number of people in the family). I've previously used Applications.SheetsInNewWorkbook to so that I have MemberCount+1 sheets (plus one for the totals).

    For NewFamilyMember = 1 To MemberCount
    Worksheets("Sheet" & NewFamilyMember).Select
    ActiveSheet.Paste
    Next NewFamilyMember
    Attached Files Attached Files

+ 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] Create workbook with multiple worksheets
    By vio.coman in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-29-2014, 03:00 PM
  2. [SOLVED] Create CSV files from 2-3 worksheets from workbook & keep workbook intact
    By clage in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-22-2013, 01:15 PM
  3. Using Vba create another workbook then update the formulas of main workbook
    By rename in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-29-2012, 06:12 AM
  4. Replies: 2
    Last Post: 02-15-2010, 09:59 PM
  5. Several worksheets same workbook same formulas
    By JLC2009 in forum Excel General
    Replies: 3
    Last Post: 03-04-2009, 05:40 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