The code starting with an apostrophy works just fine, i.e. filling the array with the entire worksheet.
Filling the array with only the 6 specific columns renders a compiling error. Wrong number of arguments or invalid property(error 450).
https://docs.microsoft.com/nl-nl/office ... 6rd%3Dtrue
I have been looking for a solution but can't seem to find one. I am not sure but could f.i. adding column by column with redim preserve help here. I have never used that before. Or is there a different way to fill the array in this case.
The relevant code is:
Code: Select all
'Hier de laatste rij opzoeken
Dim apv_laatste_rij As Long
With sh_apv_data
apv_laatste_rij = .Cells(.Rows.Count, "A").End(xlUp).Row
End With
'De array dynamisch dimmen
Dim apv_data_array() As Variant
'ReDim apv_data_array(1 To apv_laatste_rij, 1 To 62)
ReDim apv_data_array(1 To apv_laatste_rij, 1 To 6)
'De array vullen met data
'apv_data_array = sh_apv_data.Range("A1:BJ" & apv_laatste_rij)
apv_data_array = sh_apv_data.Range("C1:C" & apv_laatste_rij, "G1:G" & apv_laatste_rij, _
"N1:N" & apv_laatste_rij, "V1:V" & apv_laatste_rij, "Y1:Y" & apv_laatste_rij, "Z1:Z" & apv_laatste_rij)