View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
David Copp[_4_] David Copp[_4_] is offline
external usenet poster
 
Posts: 3
Default Looking for faster method for Copy & Paste

Hi,

I have a sheet with references to workbooks, sheets, cell addresses and
values whose values need to be copied to the aforementioned workbook, sheet
and address reference.

Ref_sheet looks something like the following...
workbook worksheet address value
1.xls Sheet1 $A$1 Hello
1.xls Sheet1 $A$2 World
2.xls Sheet1 $J$10 10
2.xls Sheet2 $Z$100 32,000

Current method loops through above rows and copies and pastes each value to
location (i.e. copy "Hello" to book "1.xls", sheet "sheet1" to range
"$A$1").
(Needs to be copy & paste to preserve formatting)

For i = row_min To row_max
ref_sheet.Cells(i, 4).Copy
Destination:=Workbooks(CStr(ref_sheet.Cells(i,
1))).Worksheets(CStr(ref_sheet.Cells(i, 2))).Range(ref_sheet.Cells(i, 3))
Next i

where ref_sheet references above sheet... works well but I think it's a
little slow; averaging about 588 records per second (10,000 records taking
about 17 seconds) on a P4 Celeron 2.4 in Excel 97.
Since any of workbook, sheet and address could change row by row, IMHO, need
to evaluate each book, sheet and address reference. (yuck!)

Any suggestions gratefully appreciated.

Thanks in advance,

David Copp