View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Mirco Wilhelm[_2_] Mirco Wilhelm[_2_] is offline
external usenet poster
 
Posts: 6
Default Error 1004, Application-definded or object-defined error

This has unqualified ranges. If this code is in a general module then the
unqualified cells will refer to the activesheet.


Jep, that's just what it's supposed to do, copy content from one sheet in
ThisWorkbook to another

Worksheets(strDestWorksheetame).Range(Cells(lngLas tRow, 1), _
Cells(lngLastRow + 52, 10)).PasteSpecial xlPasteAll

I'd qualify them using with/end with (to save typing):

with Worksheets(strDestWorksheetame)
.Range(.Cells(lngLastRow, 1), _
.Cells(lngLastRow + 52, 10)).PasteSpecial xlPasteAll
end with


Ok, I see the point, but why does this function work on it's first run but
not on any of the following?