Populate the call data to 2D array speedy

Ongbey

New Member
Joined
Oct 16, 2018
Messages
29
Office Version
  1. 2013
Hi,

I have speed complaint about populate the cell values to the 2D arrays. I copied a part of VBA code to here.
Please suggest a speedy code.
Thanks in advance.

VBA CODE
------------------------------------------------
Public List(11, 5), dimsayi As Integer
Public Sub Test()
-------------------------------------------------
sayi = [B1]: dimsayi = 0

For n = 4 To sayi * 4 Step 4
dimsayi = dimsayi + 1
List(dimsayi, 1) = 2: List(dimsayi, 2) = Cells(n, 1): List(dimsayi, 3) = Cells(n + 1, 1): List(dimsayi, 4) = Cells(n + 2, 1): List(dimsayi, 5) = Cells(n + 3, 1)
Next n
End Sub
--------------------------------------------------

B1 formula = (C1-3)/4
C1 formula =MATCH("TOTAL";A1:A400;0)-1

Ekran Alıntısı.JPG



17719
PART1
1
PCS
17720
PART2
1
PCS
17722
PART3
1
PCS
17726
PART4
1
PCS
35147
PART5
1
PCS
53860
PART6
2
PCS
53925
PART7
4
PCS
6403055E
PART8
1
PCS
68631
PART9
0,1
PCS
68733
PART10
0,00833
PCS
74147
PART11
2
PCS
TOTAL
 
Flashbond

Thanks for your efforts. However, both of your codes failed. Is it because my version is Excel 2013?

Ekran Alıntısı3.JPG
Ekran Alıntısı.JPG
 
Upvote 0

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Or even post 7, I left the 'Public List As Variant, dimsayi As Integer' in as I had assumed you were using it after the sub had run.

Also worth adding the 'Option Explicit' to the top of your Module as it forces you to dim every variable which IMO is important.
 
Upvote 0

Forum statistics

Threads
1,215,110
Messages
6,123,138
Members
449,098
Latest member
Doanvanhieu

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