View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
GS[_6_] GS[_6_] is offline
external usenet poster
 
Posts: 1,182
Default How to copy to a specific worksheet?

Terry,
As with refs to a sheet (Sheets("Source")) where it refs a specific
sheet in the 'Sheets' collection of the active workbook, so too must
you ref a workbook! So...

Destination:=Workbooks("Walk Index").Sheets("TEMP").Range("C16")

...where workbooks is plural, and you omitted the dot before Sheets.

Note that in the case of Workbooks() you are referring to the workbooks
collection of the running instance of Excel. This means the file must
be open! If you want to read/write closed workbooks then that requires
using an ADODB recordset which involves a somewhat steep learning
curve. Alternatively, you can turn ScreenUpdating off and process
'behind-the-scene' but involves considerable overhead when doing
several files; -making the user wait until the process ends.

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion