VBA For loop taking way too long

Baxta

New Member
Joined
Jul 25, 2011
Messages
2
Hi guys, hoping you can help.

Im using a for loop to populate a spreadsheet from a HTTPrequest and its just taking ages. It already has to go through a JSON parser and populating the sheet cell by cell is just not practical.

Any help would be appreciated

Here we go:

Set json = lib.parse(HttpReq.ResponseText)
For x = 1 To json("results").Count
For y = 1 To lastColumn
Sheet11.Cells(x + 2, y) = json("results")(x)("" & Sheet11.Cells(2, y) & "")
Next y
Next x
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
I'm guessing you already turned off the screenupdates & alerts, but if not - I would definitely make sure u did.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
If above is already in place (which I'm guessing it is based code thus far) try using variables to store all the values (redim a(b)) - I've found this to speed things up for me for related data transfers / extracts across multiple network drives. It might require a little error logic though depending on data type.<o:p></o:p>
<o:p></o:p>
If you explain your project a little more and some of the sample date - I'll see if I can give better examples.<o:p></o:p>
<o:p></o:p>
Ben
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,560
Messages
6,179,520
Members
452,921
Latest member
BBQKING

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