View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
munt via OfficeKB.com munt via OfficeKB.com is offline
external usenet poster
 
Posts: 3
Default Copy only some existing worksheets to a new workbook

Hi,

Thanks for that - it almost worked.

It's now copying each spreadsheet to a seperate workbook whereas I wanted
them in one workbook.



exceluserforeman wrote:
Hi,
Rather that looking for the sheets to copy, why not look for the sheets not
to copy?

dim intNum, intCount as integer
dim strSheetNamer1, shtName2 as string
strSheetName1="Not This One"
strSheetName2="Or This One"

intCount=sheets.count

for intNum=1 to intCount-2
'minus 2 because of those 2 you do not want
if sheets(intNum) .name<strSheetName1 or _
sheets(intNum) .name<strSheetName2 _
then
sheets(intNum).Copy
'to whereever

end if
next intnum

Hi,

[quoted text clipped - 51 lines]
Sheets(Array(worksheet_to_copy)).Select
Sheets(Array(worksheet_to_copy)).Copy