VBA code Filter by Array has Memory Full error. Please fix the code

Excelpromax123

Board Regular
Joined
Sep 2, 2021
Messages
172
Office Version
  1. 2010
Platform
  1. Windows
Hello everyone on the Forum. I'm using the code below to filter an area with about 800,000 lines, but the code reports a memory full error as shown. I tried 500,000 and it didn't work. Please advise how to fix the error. Sincerely thank !
VBA Code:
Sub test()
Dim sArr(), dArr(), Dk1 As String, I As Long, K As Long, R As Long, Col As Long, a As Long
a = 700000
sArr = Range("A1:S" & a).Value
R = UBound(sArr)
ReDim dArr(1 To R, 1 To 19)
For I = 1 To R
    If sArr(I, 6) = 3 Then
        K = K + 1
        For Col = 1 To 19
            dArr(K, Col) = sArr(I, Col)
        Next Col
    End If
Next I
Range("V1:AN1000000").ClearContents
Range("V1").Resize(K, 19) = dArr
End Sub
1694422831316.png

Data excel
1694422893729.png

 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Hi


The primary benefit of using Office 64-bit instead of Office 32-bit, is the amount of available memory. With 32-bit Office, the application can only use 2GB of RAM memory, but with 64-bit Office there is no limit.

 
Upvote 0

Forum statistics

Threads
1,224,814
Messages
6,181,120
Members
453,021
Latest member
Justyna P

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