+ Reply to Thread
Results 1 to 11 of 11

Urgent help: Creating new sheets with template included

Hybrid View

  1. #1
    Registered User
    Join Date
    05-13-2013
    Location
    Corsham, england
    MS-Off Ver
    Excel 2013
    Posts
    16

    Urgent help: Creating new sheets with template included

    Hi all

    i am trying to create new sheets from a list but i also want to insert a template into these new sheets

    i have created the template on another sheet and i am trying to copy and paste it to the new sheets whilst they are being created

    this is my code so far
    Sub Auto_Quotes()
        Dim MyCell As Range, MyRange As Range
        
        Set MyRange = Sheets("Summary").Range("A2")
        Set MyRange = Range(MyRange, MyRange.End(xlDown))
    
        For Each MyCell In MyRange
            Sheets.Add After:=Sheets(Sheets.Count) 'creates a new worksheet
            Sheets(Sheets.Count).Name = MyCell.Value ' renames the new worksheet
            Worksheets("Template").Rows().Copy 
            Worksheets("Template").Select           'copies template
            Worksheets("Sheets.count").Rows().Select
            Worksheets("Sheets.count").Paste
        Next MyCell
    End Sub
    It gets to the point where it copys the template to the clipboard but then fails and will not paste it into the newly created sheet

    then after i have created this macro i will be wanting some help with another code that transfers the data over from the summary to the relevant places on the template

    hope this all makes some sense to you all

    i am still learning but honestly enjoying it as once you succeed it feels great
    please find example at the bottom

    cheers
    Last edited by Vaughan.jamie; 04-16-2015 at 07:13 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    11-12-2014
    Location
    Nottingham
    MS-Off Ver
    2013
    Posts
    383

    Re: Urgent help: Creating new sheets with template included

    Would it be easier to make a copy of the template spreadsheet rather than add a new sheet and copy the contents of it?

  3. #3
    Registered User
    Join Date
    05-13-2013
    Location
    Corsham, england
    MS-Off Ver
    Excel 2013
    Posts
    16

    Re: Urgent help: Creating new sheets with template included

    I'm not sure this is where im stuck and need the help with

  4. #4
    Registered User
    Join Date
    05-13-2013
    Location
    Corsham, england
    MS-Off Ver
    Excel 2013
    Posts
    16

    Re: Urgent help: Creating new sheets with template included

    How would i make a copy of the template sheet and make it rename itself from the list on the summary

  5. #5
    Valued Forum Contributor
    Join Date
    11-12-2014
    Location
    Nottingham
    MS-Off Ver
    2013
    Posts
    383

    Re: Urgent help: Creating new sheets with template included

    Try this:

    Sub Auto_Quotes()
        Dim MyCell As Range, MyRange As Range
        
        Set MyRange = Sheets("Summary").Range("A2")
        Set MyRange = Range(MyRange, MyRange.End(xlDown))
    
        For Each MyCell In MyRange
            Sheets("Template").Copy After:=Sheets(Sheets.Count)
                ActiveSheet.Name = MyCell.Value
        Next MyCell
    End Sub
    I am Imagining the next part is to fill in the information automatically too...If you need help, then let me know

    ALSO: in future make sure any sheets you upload are anonymous!

  6. #6
    Registered User
    Join Date
    05-13-2013
    Location
    Corsham, england
    MS-Off Ver
    Excel 2013
    Posts
    16

    Re: Urgent help: Creating new sheets with template included

    Hi

    Your a legend that works perfectly

    how do i make attachments anon?

  7. #7
    Valued Forum Contributor
    Join Date
    11-12-2014
    Location
    Nottingham
    MS-Off Ver
    2013
    Posts
    383

    Re: Urgent help: Creating new sheets with template included

    No problem. And I meant by removing the schools names! Now that it is solved please remove the attachment and mark the thread as solved by editing your original post!

    ARowbot

  8. #8
    Registered User
    Join Date
    05-13-2013
    Location
    Corsham, england
    MS-Off Ver
    Excel 2013
    Posts
    16

    Re: Urgent help: Creating new sheets with template included

    thanks so much ARowbot
    Last edited by Vaughan.jamie; 04-16-2015 at 07:14 AM.

  9. #9
    Valued Forum Contributor
    Join Date
    11-12-2014
    Location
    Nottingham
    MS-Off Ver
    2013
    Posts
    383

    Re: Urgent help: Creating new sheets with template included

    I've done it slightly differently to what you proposed but it should have the same effect!!

    P.S Don't edit posts if you ask somebody to do something more also...Makes me look silly!
    Attached Files Attached Files
    Last edited by ARowbot; 04-16-2015 at 07:25 AM.

  10. #10
    Registered User
    Join Date
    05-13-2013
    Location
    Corsham, england
    MS-Off Ver
    Excel 2013
    Posts
    16

    Re: Urgent help: Creating new sheets with template included

    OMG

    ARowbot

    is a Legend that is exactly what i needed

    cheers

  11. #11
    Registered User
    Join Date
    05-13-2013
    Location
    Corsham, england
    MS-Off Ver
    Excel 2013
    Posts
    16

    Re: Urgent help: Creating new sheets with template included

    Hi ARowbot

    i was just playing around with your formula which is great by the way and works perfectly

    But i noticed if i add another school/client after i have saved and closed it then run the macro again it fails because it starts from the beginning again would i need to write a different macro that does what the other one does but doesn't try to duplicate the originals

    and i notice aswell with it if i change a price in the file then try to run again to update it does the same as above is there a way round this??

    cheers

+ 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] Creating new sheets based off template
    By pauldaddyadams in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-24-2015, 09:00 PM
  2. [SOLVED] [Urgent] Creating a Macro to Copy Time sheets Data of employees into Master Sheet
    By kkcmania in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 05-12-2014, 01:12 AM
  3. [SOLVED] Urgent Help: Find if any of the two values is included in a range of cell
    By faizzsheikh in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-19-2013, 09:49 AM
  4. [SOLVED] Creating Sheets from a Template
    By CRW in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-13-2012, 11:59 AM
  5. [SOLVED] Creating new sheets with Template
    By DanielRay in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 11-30-2011, 07:12 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