+ Reply to Thread
Results 1 to 5 of 5

Overwrite existing excel sheets

  1. #1
    Registered User
    Join Date
    08-14-2011
    Location
    Switzerland
    MS-Off Ver
    MacOffice 2011, Excel
    Posts
    17

    Overwrite existing excel sheets

    Referring to this forum posting http://www.excelforum.com/excel-prog...ll-values.html and the code (see below), I would like to ask, if anyone may help to change the code so that the macro does not overwrite existing sheets in an excel file. For example, if I have three sheets in an excel file, and I am running the code on sheet1, it should be avoided that sheet2 and sheet3 are overwritten and instead new sheets should be created.

    Please Login or Register  to view this content.
    [/QUOTE]

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Overwrite existing excel sheets

    Hi,

    See if this link helps with your code.
    http://www.ozgrid.com/VBA/IsWorkbookOpen.htm
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    08-14-2011
    Location
    Switzerland
    MS-Off Ver
    MacOffice 2011, Excel
    Posts
    17

    Re: Overwrite existing excel sheets

    Quote Originally Posted by MarvinP View Post
    Hi,

    See if this link helps with your code.
    http://www.ozgrid.com/VBA/IsWorkbookOpen.htm
    yes, indeed that may help!!! DoesSheetExist should check if the sheet exists, any idea how this information can be used, not to overwrite an existing one and to create a new one? I am so sorry... it seems quite complicated for me as a beginner to solve this problem :-(

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Overwrite existing excel sheets

    If the sheet exists then create a new one. I'd turn on my macro recorder and create a new sheet to see what code is generated.

    I hope that helps. It is just hard to read someones code without seeing the sheet names and getting an idea of what is supposed to happen.

  5. #5
    Registered User
    Join Date
    08-14-2011
    Location
    Switzerland
    MS-Off Ver
    MacOffice 2011, Excel
    Posts
    17

    Re: Overwrite existing excel sheets

    A solution to a similar issue is provided here: http://www.excelforum.com/excel-prog...content-2.html

+ 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