Macro to copy from one source sheet to numerous destination sheets

M

msdrolf

Each row in my source worrksheet has data to be entered into many destination
worksheets. I have tried the following:

Windows(Source).Activate
Range(row, 2).Select
Selection.Copy
Windows(dept & ".xls").Activate
Worksheets("Info").Activate
Range("C3").Select
ActiveSheet.Paste

My problem is that the "Range(row,2).select" command does not work. Can
someone provide me with a command line which would work. Thanks
 
T

Tim Williams

You sould always qualify any Range() reference with the containing worksheet
(and that with its workbook)
That removes all ambiguity and the source of many bugs.
It's not clear from your code which worksheet in the "source" workbook will
be copied from, but something like this should work. Note use of Cells()
for the source range.

'**************************
dim rng Src as range, rngDest as range

set rngSrc=Workbooks(Source).worksheets("whatever").cells(row, 2)
set rngDest=workbooks(dept & ".xls").worksheets("Info").Range("C3")

rngSrc.copy rngDest
'**************************

Tim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top