ItalianPlatinum
Well-known Member
- Joined
- Mar 23, 2017
- Messages
- 857
- Office Version
- 365
- 2019
- Platform
- Windows
I am running into a runtime error trying to transfer data using VBA I used before so I know it works. But when facing a larger data set it is kicking out the below. is there any root cause / solution I can entertain?
at this spot it fails
VBA Code:
If Application.WorksheetFunction.CountIf(rng, ">1") > 0 Then
'transfer data over to Compare tab
vCols = Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17) '<- Columns of interest in specified order
With WsSec
With .Range("A11:R" & .Range("H" & rows.count).End(xlUp).row)
vRows = Application.Index(.Cells, Evaluate("row(1:" & .rows.count & ")"), Array(17))
For ii = 1 To UBound(vRows)
If vRows(ii, 1) > "1" Then
kk = kk + 1
vRows(kk, 1) = ii
End If
Next ii
nrALL = WsALL.Range("A" & rows.count).End(xlUp).row + 1
WsALL.Range("A" & nrALL).Resize(kk, UBound(vCols) + 1).Value = Application.Index(.Cells.Value, Application.Index(vRows, 0, 1), vCols)
End With
End With
End If
kk = 0
ii = 0
rng = 0
Debug.Print "CountIf Formula/delete/transfer... : " & Format(Timer - t, "0.00") & " seconds"
'apply filter to start and activate sheet
With WsSec
.Application.Calculation = xlManual
.Range("A10").CurrentRegion.Delete
End With
i = i + 1
Loop
With WsALL
lr2 = .Cells(rows.count, "A").End(xlUp).row 'find the maximum row
.Cells.EntireColumn.AutoFit
.Range("1:1").AutoFilter
End With
Else
at this spot it fails
VBA Code:
WsALL.Range("A" & nrALL).Resize(kk, UBound(vCols) + 1).Value = Application.Index(.Cells.Value, Application.Index(vRows, 0, 1), vCols)