+ Reply to Thread
Results 1 to 10 of 10

Deleting Multiple Selected Sheets

  1. #1
    Registered User
    Join Date
    01-23-2013
    Location
    New York, NY
    MS-Off Ver
    Excel 2010
    Posts
    18

    Deleting Multiple Selected Sheets

    Hi - this code is part of a much larger code, but is essentially the very end. The code pastes values in for a bunch of graphs, then copies iterations of that sheet onto new sheets so that they can all be printed at the end. Then, I want to delete the sheets that the code creates. Everything works perfectly - Including printing ONLY the sheets it has selected, but for some reason activesheet.delete does not apply to all the sheets selected - it only deletes the last one. Does anyone know why / have any ideas?

    Relevant part of code:

    Please Login or Register  to view this content.
    Last edited by jeffreybrown; 03-26-2019 at 05:52 PM. Reason: Please use code tags!

  2. #2
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,150

    Re: Deleting Multiple Selected Sheets

    It's not a code, it's some plain text that does not have the form of a code ...

  3. #3
    Registered User
    Join Date
    01-23-2013
    Location
    New York, NY
    MS-Off Ver
    Excel 2010
    Posts
    18

    Re: Deleting Multiple Selected Sheets

    Hi - I didn't think it was relevant to post the entire code, everything works, except deleting multiple sheets at the end. Obviously there is stuff like Dim iCTR as integer, etc at the top, but I'm just having an issue with this one section - it just deletes the last sheet, not all of the ones it has selected. If I'm mistaken and the entire code has to be posted, please let me know.

  4. #4
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,150

    Re: Deleting Multiple Selected Sheets

    Ad 1. I meant that:
    Please Login or Register  to view this content.
    and
    Please Login or Register  to view this content.
    and etc.

    Ad2. From fragments of matter(-s), shamans foretell ...

    Ad 3. This snippet of code (in 'For...Next' loop):
    Please Login or Register  to view this content.
    does not select all sheets, only individually, then the next one.

  5. #5
    Registered User
    Join Date
    01-23-2013
    Location
    New York, NY
    MS-Off Ver
    Excel 2010
    Posts
    18

    Re: Deleting Multiple Selected Sheets

    I don't know how to do the special code sections in the reply, but this part:


    Please Login or Register  to view this content.
    DOES select all the sheets - they are all highlighted if I exit the code. And the export to PDF works - all of the selected sheets are highlighted and export correctly, not the first three sheets in my workbook.
    Last edited by ajm036; 03-27-2019 at 09:04 AM.

  6. #6
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Deleting Multiple Selected Sheets

    Administrative Note:
    • We would love to continue to help you with your query, but first, before we can proceed…
    • Please see Forum Rule #2 about the proper use of code tags and adjust accordingly...
    Last edited by jeffreybrown; 03-26-2019 at 06:04 PM.
    HTH
    Regards, Jeff

  7. #7
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,150

    Re: Deleting Multiple Selected Sheets

    Ad 1.
    Quote Originally Posted by ajm036 View Post
    DOES select all the sheets
    You're right, with the 'replace:= false' argument, code expands the selection to other sheets.

    Ad 2. Correct the tags, because moderator will block the answers.

  8. #8
    Registered User
    Join Date
    01-23-2013
    Location
    New York, NY
    MS-Off Ver
    Excel 2010
    Posts
    18

    Re: Deleting Multiple Selected Sheets

    Hi - apologies, edited to comply with code tags.

  9. #9
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,150

    Re: Deleting Multiple Selected Sheets

    Try this scheme:
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    01-23-2013
    Location
    New York, NY
    MS-Off Ver
    Excel 2010
    Posts
    18

    Re: Deleting Multiple Selected Sheets

    That worked perfectly, thank you!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Deleting multiple sheets using vba code
    By Narendra kishore in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-04-2017, 10:31 AM
  2. Macro for deleting rows on multiple sheets
    By jyarbrough in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-09-2015, 05:36 PM
  3. [SOLVED] adding or deleting in multiple sheets
    By Excelski in forum Excel General
    Replies: 12
    Last Post: 06-22-2015, 02:27 PM
  4. [SOLVED] Deleting rows across multiple sheets?
    By kickme93 in forum Excel General
    Replies: 1
    Last Post: 09-16-2013, 09:08 AM
  5. Mirror row deleting on multiple sheets.
    By MarVil85 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-20-2012, 02:59 PM
  6. deleting column in multiple sheets
    By walid66 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-13-2008, 07:07 PM
  7. Deleting multiple sheets
    By hshayh0rn in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 04-11-2006, 02:00 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