Looping through an Array to load cells has slow performance

Vancity

New Member
Joined
Sep 24, 2008
Messages
17
I have a 7x2 array with integer values in the first dimension and column # stored in the second.
Below I've looped through the array to load 7 cells, but performance takes a HUGE hit.
Code:
For i = 1 To 7
                Cells(ActiveCell.Row, sngArrayCT(i, 2)) = sngArrayCT(i, 1)
 Next i
I've read that this should be avoided, whats the proper way?
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
The proper way to do what exactly?:eek:

Where do the values in the array come from and where are they going?:)
 
Upvote 0
The value in the array is calculated, and the column number loaded in another process. These values need to be loaded into the given column number for the active row.

The reason the column numbers are in the array is that they are found by using a Find function on the header of the data (which comes from an Oracle DB). I didn't want to hard code col #'s in, so I store them with the new value in the array.
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,732
Members
448,987
Latest member
marion_davis

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top