+ Reply to Thread
Results 1 to 8 of 8

Delete A Worksheet From All Workbooks In A Folder

  1. #1
    Registered User
    Join Date
    10-24-2010
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    49

    Delete A Worksheet From All Workbooks In A Folder

    I have been looking for a piece of code that will delete a worksheet from every workbook in a folder, but cannot find any examples.

    The worksheet may not exist, so if it does not the code should move onto the next workbook in the folder, no error messages are required.

    Can anybody help me.
    Last edited by AlexRoberts; 07-15-2011 at 06:44 AM.

  2. #2
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Delete A Worksheet From All Workbooks In A Folder

    Hi AlexRoberts, try
    Please Login or Register  to view this content.
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  3. #3
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: Delete A Worksheet From All Workbooks In A Folder

    Here is code that will do that. It is well commented so you know what each line of code does. You need to change the folder path to your folder, and the sheet name to your sheet you are looking to delete.

    Please Login or Register  to view this content.
    Last edited by davegugg; 07-13-2011 at 12:43 PM.
    Is your code running too slowly?
    Does your workbook or database have a bunch of duplicate pieces of data?
    Have a look at this article to learn the best ways to set up your projects.
    It will save both time and effort in the long run!


    Dave

  4. #4
    Registered User
    Join Date
    10-24-2010
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    49

    Re: Delete A Worksheet From All Workbooks In A Folder

    Dave,

    Thanks for this.

    A further question, it has just occurred to me that a spreadsheet may be open, is there a way to (a) ignore spreadsheets that are open and (b) list the file name of those open spreadsheets in another spreadsheet (log of some sort).

    Thank you.

  5. #5
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: Delete A Worksheet From All Workbooks In A Folder

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    10-24-2010
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    49

    Re: Delete A Worksheet From All Workbooks In A Folder

    The time you have saved me, thank you.

  7. #7
    Registered User
    Join Date
    12-01-2008
    Location
    India
    MS-Off Ver
    Microsoft 365 Enterprise - Excel version2301
    Posts
    67

    Re: Delete A Worksheet From All Workbooks In A Folder

    Hi Davegugg , can you please amend code for me so that it unhide the particular hidden sheet and then delete it from all the workbooks in a folder?

    Thanks & regards,

    AG

  8. #8
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: Delete A Worksheet From All Workbooks In A Folder

    If you have an issue Amarjeet, please read the forum rules (specifically # 2) and then start a new thread. You can post a link to this thread if you feel it contains relevant information.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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