+ Reply to Thread
Results 1 to 3 of 3

Copy active sheet to a new workbook

  1. #1
    Registered User
    Join Date
    01-29-2013
    Location
    Bristol, England
    MS-Off Ver
    Excel 365
    Posts
    40

    Copy active sheet to a new workbook

    I have put a macro on one workbook to copy the active sheet to a new workbook. I have also assigned this macro to a shortcut button on my Macro toolbar.

    However, I would like this button to work for any workbook I have open. At the moment, whatever workbook I have open and I click the button it still copies the last sheet I had active in the original workbook.

    Sub Macro23()

    'Copy sheet, and send to new workbook
    ThisWorkbook.ActiveSheet.Copy _
    Before:=Workbooks.Add.Worksheets(1)

    End Sub

    Can someone please tell me what to adjust so that it will work for the active sheet in ANY workbook.

    Thank you

  2. #2
    Valued Forum Contributor
    Join Date
    03-29-2013
    Location
    United Kingdom
    MS-Off Ver
    Office/Excel 2013
    Posts
    1,749

    Re: Copy active sheet to a new workbook

    Delete the "ThisWorkbook."................. Thisworkbook refers to the workbook the macro is resident in
    Elegant Simplicity............. Not Always

  3. #3
    Registered User
    Join Date
    01-29-2013
    Location
    Bristol, England
    MS-Off Ver
    Excel 365
    Posts
    40

    Re: Copy active sheet to a new workbook

    Thank you. I tried the code without "ThisWorkbook." but it is still doing the same thing for some reason.

    Does anyone know a simple macro code to copy a sheet to a new workbook that will work for any workbook as I think mine was rubbish lol?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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