Hi Charlie, It's because the macro excludes the sheet named "Summary", but the actually sheet name is in all lower case ("summary"), so the macro copies the cells from the first 5 sheets, then reaches the summary sheet, copies the 5 numbers it already copied to the summary sheet FROM the summary sheet and pastes them to the end of the list before continuing on correctly.
I discovered this by setting a breakpoint in the code and stepping through while watching the changes to the summary sheet. Asa From: excel-macros@googlegroups.com [mailto:excel-macros@googlegroups.com] On Behalf Of Cab Boose Sent: Monday, February 27, 2012 10:22 PM To: excel-macros@googlegroups.com Subject: Re: $$Excel-Macros$$ Excude some sheets in macro Hi Don and all Yes Don I totally agree that I should know better. But I am trying hard to understand everything. I have attached the workbook again with the new code installed. It is doing a strange thing, and I have looked as to why but cannot ascertain. When the macro is run it lists 15 entries. There are only 10 to be listed. The first 5 are listed and then under that the correct 10 are listed. The tabs are not in any order. And I have added a few more tabs as well. Could be something to do with this. Appreciate your help. Don BTW I have a keen interest in US railroads in Texas! Cotton Belt especially. Regards to all Charlie Harris On Tue, Feb 28, 2012 at 2:28 AM, dguillett1 <dguille...@gmail.com> wrote: You have been doing this awhile and should know better. Anyway. Sub copycorrectsheets() Dim ws As Worksheet For Each ws In Worksheets If ws.Name <> "Summary" _ And ws.Name <> "forms" _ And ws.Name <> "admin" Then ws.Range("G7").CurrentRegion.Copy _ Worksheets("summary").Cells(Rows.Count, "G").End(xlUp)(2) End If Next ws End Sub Don Guillett SalesAid Software dguille...@gmail.com From: Cab Boose <mailto:swch...@gmail.com> Sent: Sunday, February 26, 2012 10:45 PM To: excel-macros@googlegroups.com Subject: $$Excel-Macros$$ Excude some sheets in macro Hi See attachedI workbook. XL2000 Refer to summary sheet I am wanting to extract data from some sheets into summary sheet. I can exclude 1 sheet ok, but when I try to exclude others I get syntax error. The line of code with problem is: If Worksheets(k).Name = "summary", "forms", "admin" Then GoTo nextk I do not want to copy cells in summary, forms, or admin. Something to do with the commas, have tried also without the commas. Should I clear the summary sheet each time before paste or delete sheet and make a new one called summary? Thanks and regards Charlie Harris -- FORUM RULES (986+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. ---------------------------------------------------------------------------- -------------------------- To post to this group, send email to excel-macros@googlegroups.com -- FORUM RULES (986+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. ---------------------------------------------------------------------------- -------------------------- To post to this group, send email to excel-macros@googlegroups.com -- FORUM RULES (986+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. ---------------------------------------------------------------------------- -------------------------- To post to this group, send email to excel-macros@googlegroups.com -- FORUM RULES (986+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. ------------------------------------------------------------------------------------------------------ To post to this group, send email to excel-macros@googlegroups.com