+ Reply to Thread
Results 1 to 5 of 5

If sheets exists in another workbook overwrite it

  1. #1
    Registered User
    Join Date
    11-20-2009
    Location
    Cardiff
    MS-Off Ver
    Excel 2010
    Posts
    25

    If sheets exists in another workbook overwrite it

    I have the following code which copies a sheet to another workbook and renames it with the current date. However I need it to check if there is a sheet already existing in the other workbook with todays date first. If there is then it should delete the old sheet and copy the new sheet or just overwrite it.

    Please Login or Register  to view this content.
    Last edited by Mistweaver; 11-27-2009 at 01:03 PM.

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,935

    Re: If sheets exists in another workbook overwrite it

    Please Login or Register  to view this content.
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    11-20-2009
    Location
    Cardiff
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: If sheets exists in another workbook overwrite it

    Thanks a lot.

    I have incorporated it into my code however my head is now smoking because I am not copying the sheet into the other workbook ("Head Count.xls") anymore. It is copying it to the end of the active workbook ("Shared Pit.xls").

    How can I change the code to copy the active sheet in ("Shared Pit.xls") into the other workbook ("head count.xls") and not the active workbook ("Shared Pit.xls")

    Here's my code. I appreciate all help greatly.

    Please Login or Register  to view this content.

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,972

    Re: If sheets exists in another workbook overwrite it

    Try this:
    Please Login or Register  to view this content.
    Everyone who confuses correlation and causation ends up dead.

  5. #5
    Registered User
    Join Date
    11-20-2009
    Location
    Cardiff
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: If sheets exists in another workbook overwrite it

    Thanks for the help.

    Works perfectly. Many thanks mate.

+ 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