+ Reply to Thread
Results 1 to 9 of 9

Dynamically Create Sheets and Copy Data

  1. #1
    Registered User
    Join Date
    08-12-2004
    Posts
    45

    Dynamically Create Sheets and Copy Data

    Hi All,

    Regretably ( or embarassingly ) I am not even sure where to start with this challenge - normally I can edit a bit (lot) of code and get something working.

    INPUT - My challenge is I have approximately 26 columns of data in a long list with headings and a field call Account Exec. some of these values are also numeric - a Client Income Report.

    OUTPUT - What I am looking to do is take the aforementioned data 1. Create a New Sheet for Each Person in the List 2. Copy the headings into Row 1 from original sheet 3. Copy data only for that person to that sheet 4. In Row 3 put in a down total.

    I have attached a sample to hopefully show better how this should look.

    Happy to expand further if anyone has a follow-up.

    Thanks in advance.

    Rob
    Attached Files Attached Files

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,808

    Re: Dynamically Create Sheets and Copy Data

    Try:
    Please Login or Register  to view this content.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  3. #3
    Registered User
    Join Date
    08-12-2004
    Posts
    45

    Re: Dynamically Create Sheets and Copy Data

    Mumps1 - Thanks so much and its exactly what I was looking for.

    Next challenge is not to simply copy paste but figure out what its doing - learn a bit

    Have a great weekend

  4. #4
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,808

    Re: Dynamically Create Sheets and Copy Data

    You are very welcome.

  5. #5
    Registered User
    Join Date
    08-12-2004
    Posts
    45

    Re: Dynamically Create Sheets and Copy Data

    Quote Originally Posted by Mumps1 View Post
    Try:
    Please Login or Register  to view this content.
    If I may ask for some direction please - if I wanted to do some additional formatting of the new sheets whereabouts in the code should I be working.

    I did try the red below in a few places without success. My logic was it had to be around the area where summation was taking place. I am OK with formatting cells etc. just the placement is the issue (I think).

    Thanks again for your help and guidance.

    For Each rName In rngUniques
    Set desWs = Sheets(rName.Value)
    Sheets(rName.Value).UsedRange.Offset(1, 0).ClearContents
    Sheets("Sheet1").Range("E1:E" & bottomE).AutoFilter Field:=1, Criteria1:=rName
    Sheets("Sheet1").Range("E2:E" & bottomE).SpecialCells(xlCellTypeVisible).EntireRow.Copy Sheets(rName.Value).Cells(Rows.Count, "A").End(xlUp).Offset(4, 0)
    LastRow = Sheets(rName.Value).Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    For Each rng In Sheets(rName.Value).Range("G3:Y3")
    rng = WorksheetFunction.Sum(desWs.Range(desWs.Cells(5, rng.Column), desWs.Cells(LastRow, rng.Column)))
    rng.NumberFormat = "_-* #,##0.00_-;-* #,##0.00_-;_-* ""-""??_-;_-@_-"
    Next rng
    Sheets(rName.Value).Select Selection.EntireColumn.AutoFit
    If Sheets("Sheet1").AutoFilterMode = True Then Sheets("Sheet1").AutoFilterMode = False
    Next rName

  6. #6
    Valued Forum Contributor
    Join Date
    11-26-2012
    Location
    Sydney
    MS-Off Ver
    2010
    Posts
    419

    Re: Dynamically Create Sheets and Copy Data

    Your code in red replaced by this should work:
    Please Login or Register  to view this content.
    Also, after setting desWs = Sheets(rName.Value), there is no need to keep typing Sheets(rName.Value) - just type desWs.

    E.g. change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.

  7. #7
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,808

    Re: Dynamically Create Sheets and Copy Data

    Try this slightly modified version:
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    08-12-2004
    Posts
    45

    Re: Dynamically Create Sheets and Copy Data

    Quote Originally Posted by Mumps1 View Post
    Try this slightly modified version:
    Please Login or Register  to view this content.
    Thanks again - works a treat.

  9. #9
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,808

    Re: Dynamically Create Sheets and Copy Data

    My pleasure. By the way, when you respond, you don't have to respond with a quote.

+ 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 Sheets and copy Data
    By flupsie in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 06-30-2018, 10:08 AM
  2. [SOLVED] Dynamically create sheets with similar names and copy cells on row based on matched cus#
    By drewship in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-12-2016, 07:33 AM
  3. Macro to dynamically select and copy data from different sheets and columns
    By Gr8tDaze in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-01-2013, 07:32 PM
  4. VBA to create new Workbook and copy worksheet into it dynamically
    By rob read in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-21-2013, 11:55 AM
  5. To create Excel sheets dynamically
    By sugaprasad in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-24-2013, 10:26 AM
  6. Create New Sheets & Copy Specific Data To Each
    By bdb1974 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-11-2010, 05:45 PM
  7. Sheets(Array).Copy Dynamically
    By jonn in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-14-2008, 07:29 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