View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jan Kronsell[_6_] Jan Kronsell[_6_] is offline
external usenet poster
 
Posts: 4
Default Skipping sheets when copying

I have a code, that copies sheets from one workbook to another. The code looks like this:

Sub CopyShees()
Path = Range("h1")
Filename = Dir(Path & "*.xlsm")
Do While Filename < ""
Workbooks.Open Filename:=Path & Filename, ReadOnly:=True
For Each Sheet In ActiveWorkbook.Sheets
Sheet.Copy After:=ThisWorkbook.Sheets(worksheets.count)
Next Sheet
Workbooks(Filename).Close
Filename = Dir()
Loop
End Sub

And it actually works. But I like it to skip the sheets in the Activeworkbook, that already exist in ThisWorkbook, so it only copies "new" sheets from the active workbook.

I have treid different approaches but with no succes so far. Anybody?