+ Reply to Thread
Results 1 to 4 of 4

Copy data from all worksheets (except 2) paste in Summary and Delete sheets

  1. #1
    Registered User
    Join Date
    12-15-2014
    Location
    Wales, UK
    MS-Off Ver
    365
    Posts
    66

    Copy data from all worksheets (except 2) paste in Summary and Delete sheets

    Good day,

    The following code needs to Copy data from all Worksheets, except 2 specified, and paste underneath each other in the "Summary" tab, then delete the worksheets that the data was copied from.

    It works except it still copies the 2 specified not to and delete them as well. Please help.

    Please Login or Register  to view this content.
    Last edited by Simone Fick; 08-03-2017 at 09:59 AM. Reason: changed code to current error code

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Copy data from all worksheets (except 2) paste in Summary and Delete sheets

    You have specified 3 sheet names, not 2.
    If ws.Name <> pasteSheet.Name AND ws.Name <> "KAM" AND ws.Name <> "OPS" Then
    Check the sheet names are spelt correctly and check the spaces before the sheet names as well.
    Or, you can copy the sheet names directly from excel in to the code, so that they are the same.

  3. #3
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Copy data from all worksheets (except 2) paste in Summary and Delete sheets

    Or to be on the safe side use the sheets CodeNames.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  4. #4
    Registered User
    Join Date
    12-15-2014
    Location
    Wales, UK
    MS-Off Ver
    365
    Posts
    66

    Re: Copy data from all worksheets (except 2) paste in Summary and Delete sheets

    Rookie mistake, thank you. The names of the sheets were changed after and I was using them.

+ 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. Replies: 4
    Last Post: 08-25-2015, 12:00 PM
  2. string macro for a user input button, copy and paste data from all sheets to summary
    By Lawleypops in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-15-2015, 11:17 AM
  3. string macro for a user input button, copy and paste data from all sheets to summary
    By Lawleypops in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-14-2015, 11:09 PM
  4. [SOLVED] copy data from multiple worksheets and paste into summary sheet
    By forquaidian in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-19-2014, 08:27 AM
  5. Copy and paste the most recent entered data from other worksheets to summary sheet
    By cvsrini in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-18-2013, 04:51 AM
  6. [SOLVED] Copy multiple worksheets data & paste into blank columns in summary worksheet
    By guest99999 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-21-2013, 09:56 AM

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