Results 1 to 3 of 3

Copy a worksheet to the end of a pre-named Workbook - without hardcoding the workbook name

Threaded View

fireguy7 Copy a worksheet to the end... 07-12-2018, 05:52 PM
AlphaFrog Re: Copy a worksheet to the... 07-12-2018, 08:52 PM
fireguy7 Re: Copy a worksheet to the... 07-13-2018, 09:12 AM
  1. #1
    Forum Contributor
    Join Date
    07-31-2009
    Location
    Lincoln, USA
    MS-Off Ver
    Excel 2007 and excel 2010
    Posts
    142

    Copy a worksheet to the end of a pre-named Workbook - without hardcoding the workbook name

    Hello and thank you in advance.

    I have to do staff evaluations and each month I put together a scorecard with each reps stats for the month. I keep an excel workbook and copy a new tab each month onto their workbooks.

    What I can't figure out is how to enter a cell reference into the macro so I can type the workbook name into the cell and used a named range to reference this in the code.

    the code to copy the active sheet to the named sheet is pretty simple.

     ActiveSheet.Copy After:=Workbooks("Jack.xlsx").Sheets(Sheets.Count)
    It's when I try to reference the "Jack.xlsx" to a cell that I have issues.

    I've tried the following without success and can't find a online reference to what I need.

    Sub Macro1()
    
    Dim r As Range
    r = Worksheets("rep").Range("a2")
    
        ActiveSheet.Copy After:=Workbooks(r).Sheets(Sheets.Count)
       
     End Sub
    The reference cell A2 will have the workbook name that I want to copy to.

    I'm usually missing something small so any help is appreciated.

    I've attached sample sheets but I doubt you guys will need it
    WB test.xlsx, WS Feb = this is what I'm trying to copy
    Reference cell is on Rep tab on WB Test.xlsx.
    WB Jack.xlsx = this is where I'm trying to copy the Feb tab to the end of

    thanks
    Attached Files Attached Files
    Last edited by fireguy7; 07-13-2018 at 09:12 AM. Reason: Solved

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Open 2nd workbook find matching worksheet names and copy values to 1st workbook
    By Groovicles in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 05-09-2017, 10:22 AM
  2. Moving worksheet with named ranges to new workbook without referencing old workbook
    By madcaplaughs79 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-28-2014, 07:54 PM
  3. [SOLVED] Code to copy data from a closed workbook and paste in active workbook using named range.
    By paullie1912 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-28-2014, 02:38 AM
  4. Named formula scoped to workbook are duplicated on worksheet copy.
    By GeneralDisarray in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-27-2014, 02:44 PM
  5. Copy text from set range in one worksheet to named worksheet in another workbook
    By Steven811 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-25-2013, 10:55 AM
  6. Hardcoding only certain totals in a workbook
    By Gti182 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-08-2013, 05:50 AM
  7. Copying named worksheet from a workbook to a new workbook
    By s999 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-16-2010, 01:09 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