working with an spreadsheet with too many columns [VB]

jooquase

New Member
Joined
Oct 7, 2006
Messages
4
Hi All,

Just wanted to post this out there in case it could help someone out. I work alot with exports from one of our companie's application that gives out .csv files with thousands of columns. When working in VB, I noticed that my scripts were running way too slow on these files. I have one script for example that took about 210 seconds to run. I tried out just for fun to transpose the csv's content and reran the script and it now takes about 30 seconds (that's a wopping 7 times faster).

It turns out that Excel and/or VB take a much longer amount of time to find the proper cell when it's in a high number column compared a higher number row.

I knew that I had a fixed amout of rows and columns so my transpose was pretty simple :

lastCol = 3760
lastRow = WsExport.Range("a1").End(xlDown).Row
WsExport.Range("a2", WsExport.Cells(lastRow, lastCol)).Copy
WsExport.Range("a201").PasteSpecial Transpose:=True
WsExport.Rows("1:200").Delete Shift:=xlUp

Hope this helps anyone.

Regards,
Jooquase
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

Forum statistics

Threads
1,216,102
Messages
6,128,853
Members
449,471
Latest member
lachbee

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