Results 1 to 5 of 5

VBA to create new Workbook and copy worksheet into it dynamically

Threaded View

rob read VBA to create new Workbook... 08-21-2013, 10:33 AM
nathansav Re: VBA to create new... 08-21-2013, 10:42 AM
Norie Re: VBA to create new... 08-21-2013, 10:55 AM
arlu1201 Re: VBA to create new... 08-21-2013, 11:29 AM
rob read Re: VBA to create new... 08-21-2013, 11:55 AM
  1. #1
    Registered User
    Join Date
    08-20-2013
    Location
    brisbane, australia
    MS-Off Ver
    Excel 2007
    Posts
    14

    VBA to create new Workbook and copy worksheet into it dynamically

    Hi, I am creating a VBA to create a new workbook and copy a worksheet into it. I have the following code I got off youtube, which works for the first time, but when I repeat it gets an error because the code says "book1" and new book is Book2 etc

    Workbooks.Add
        Windows("INSTANT RESULTS SPREADSHEET_MACRO_V5.1.XLSM").Activate
        Sheets("REPORT").Select
        Sheets("REPORT").Copy BEFORE:=Workbooks("BOOK1").Sheets(1)
    I would also like to name the the new workbook from a combination of set term and a variable, the code I have for this is the following:



    Dim FILENAME1 As String
    Dim FILENAME2 As String
    Dim FILENAME3 As String
        FILENAME1 = "INSTANT RESULTS REPORT"
        FILENAME2 = Worksheets("REPORT CREATOR").RANGE("G15")
        FILENAME3 = Worksheets("REPORT CREATOR").RANGE("I15")
    set Newbook = Workbooks.Add
    with Newbook
    - Title=filename1 & "-" & Filename2 "-" & filename3
    I would like to do this all together if possible, create new workbook by the above naming and then copy a worksheet into it.

    cheers Rob
    Last edited by arlu1201; 08-21-2013 at 11:29 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Dynamically create workbook for employee tracking
    By DevilDog78 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-28-2012, 05:38 AM
  2. Replies: 1
    Last Post: 11-05-2011, 10:45 AM
  3. Dynamically Copy Sub-Totalled group to worksheet if criteria met
    By nezza in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-12-2009, 01:51 PM
  4. Create copy of worksheet plus code in the same workbook
    By ahmed-k in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-05-2009, 07:13 PM
  5. On click, copy the corresponding row to a new dynamically created workbook
    By munzer1 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-25-2007, 07: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