+ Reply to Thread
Results 1 to 10 of 10

Multiple Duplication of sheets based on a QTY cell value

  1. #1
    Registered User
    Join Date
    03-08-2018
    Location
    South Africa
    MS-Off Ver
    2016
    Posts
    5

    Multiple Duplication of sheets based on a QTY cell value

    Hi Guys,

    I need to create multiple templates based on a cell value. To explain. I have a template, that has to be duplicated by the number of sites the person has (one template per site)

    The number is entered in cell H2 - based on the number that is entered, that's the number of templates that needs to be generated automatically. This document will be used by anyone, and would have to accept that not everyone knows Excel.

    I have tried the following, but that only creates one sheet based on manual intervention. I myself is not an Excel Guru (this has all been googled)

    Sub Copyrenameworksheet()

    Dim ws As Worksheet
    Set Wh = Worksheets(ActiveSheet.Name)
    ActiveSheet.Copy After:=Worksheets(Sheets.Count)
    If Wh.Range("H2").Value <> "" Then
    ActiveSheet.Name = Wh.Range("H2").Value
    End If
    Wh.Activate
    Range("H2").Select
    Selection.ClearContents
    Wh.Range("H2").Activate


    End Sub

    Can anyone assist me?

    I am desperate.

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

    Re: Multiple Duplication of sheets based on a QTY cell value

    Assuming you have the value of 5 in H2, you would need copy the template 5 times. You cannot have more than one sheet with the same name. How would you like to name the 5 sheets?
    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
    03-08-2018
    Location
    South Africa
    MS-Off Ver
    2016
    Posts
    5

    Re: Multiple Duplication of sheets based on a QTY cell value

    I just need to Name them "Site A", "Site B" or "Site 1", "Site 2" - not sure if this is possible?

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

    Re: Multiple Duplication of sheets based on a QTY cell value

    Try:
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    03-08-2018
    Location
    South Africa
    MS-Off Ver
    2016
    Posts
    5

    Re: Multiple Duplication of sheets based on a QTY cell value

    AWESOME this is what I want, the only problem is, its not populating automatically. Can it populate automatically?

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

    Re: Multiple Duplication of sheets based on a QTY cell value

    What do you mean by " populate automatically"?

  7. #7
    Registered User
    Join Date
    03-08-2018
    Location
    South Africa
    MS-Off Ver
    2016
    Posts
    5

    Re: Multiple Duplication of sheets based on a QTY cell value

    When you enter the number, then I go run macro and it generates the extra sheets. Can the sheets be generated as soon as we enter the number without running the macro?

    Sorry, like mentioned I'm not at all familiar with this

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

    Re: Multiple Duplication of sheets based on a QTY cell value

    Copy and paste this macro into the worksheet code module. Do the following: right click the tab for your template sheet and click 'View Code'. Paste the macro into the empty code window that opens up. Close the code window to return to your sheet. Enter a value in H2 and exit the cell.
    Please Login or Register  to view this content.
    You can delete the previous macro.

  9. #9
    Registered User
    Join Date
    03-08-2018
    Location
    South Africa
    MS-Off Ver
    2016
    Posts
    5

    Re: Multiple Duplication of sheets based on a QTY cell value

    YESSSS!!! It works! Thank you so much! I really appreciate it!

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

    Re: Multiple Duplication of sheets based on a QTY cell value

    You are very welcome.

+ 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. Printing multiple Sheets based on a cell value within the sheet
    By coral767 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-14-2018, 12:20 AM
  2. [SOLVED] VBA code for Multiple sheets printing based on cell name
    By rajeshn_in in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-29-2016, 10:20 PM
  3. Select a cell at random based on multiple selection criteria across multiple sheets.
    By scottyms in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-03-2016, 09:44 AM
  4. Hide Row based on Cell Value on Multiple Sheets
    By xybadog in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-08-2014, 10:58 AM
  5. Replies: 2
    Last Post: 01-27-2012, 09:40 PM
  6. hide row based on cell value in multiple sheets
    By fatpiggy123 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-13-2010, 04:21 AM
  7. Showing pictures on multiple sheets based on cell value
    By grime in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-28-2006, 02:23 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