PDA

View Full Version : programmatically copying a sheet



JZB
03-17-2010, 04:01 PM
Hi all

I am trying to create a program that manages a lot of data.

i understand an effective way to approach this may be to virtualise the sheet

that was fairly straight forward

i = 1 to lastrow
j= 1 to 18

VIRT(I,J) = CELLS(I,J)

next j
next i

i have made somne changes to the data and now wish to put VIRT onto the sheet 1 for viewing:

i = 1 to lastrow
j= 1 to 18

CELLS(I,J) = VIRT(I,J)

next j
next i

however this is very slow. :think:

is there a more effective way to do this? such as current region or range etc as opposed to transferring each VIRT cell one at a time.

i have noticed that excel does not like one appllying ranges to the virtualised sheet e.g. range(VIRT(i,1),VIRT(I,18) gives me an error.

any help on this would be mnuch appreciated

Thanks

JZB

Bob Phillips
03-18-2010, 02:42 AM
Range("A1").Resize(UBound(Virt, 1) - LBound(Virt, 1) + 1, UBound(Virt, 2) - LBound(Virt, 2) + 1) = Virt


You can use a similar technique to load it, no loop.

mdmackillop
03-18-2010, 03:51 AM
You can get info at http://www.decisionmodels.com/ on speeding up execution