Ik probeer een matrix formule in een cell te plaatsen via VBA alleen krijg ik een foutcode 438 (Deze eigenschap of methode wordt niet ondersteund door dit object).
De lengte van de formule is zoals ik het zie is kleiner dan 255 tekens.
Als ik de formule als "FormulaR1C1" plaats dan werkt ie wel maar is het geen matrix formule
Voorbeeld:
Bekijk bijlage Matrix.xlsm
mvg
Kasper
De lengte van de formule is zoals ik het zie is kleiner dan 255 tekens.
Als ik de formule als "FormulaR1C1" plaats dan werkt ie wel maar is het geen matrix formule
Code:
Sub MatrixFormule()
Dim StrWs As String, StrC As String
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim strName As String
StrWs = "Jaar 1"
StrC = "X"
Worksheets(StrWs).Name = StrC
Range("I13").FormulaArray = "=IFERROR(IF(AND(VLOOKUP(" & StrC & "!R[-11]C[-4],Werkvorm,5,0)="""",OR(" & StrC & "!R[-11]C[-3]=""Eerste kans""," & StrC & "!R[-11]C[-3]=""Herkansing""))," & StrC & "!R[-11]C[-3]&"" ""&INDEX(" & StrC & "!C[-3],LARGE(--(LEFT(" & StrC & "!R2C5:R[-11]C5,7)=""Cluster"")*ROW(" & StrC & "!R2C5:R[-11]C5),1)),TRIM(" & StrC & "!R[-11]C[-3]&"" ""&VLOOKUP(" & StrC & "!R[-11]C[-4],Werkvorm,5,0))),"""")"
'Range("I13").FormulaR1C1 = "=IFERROR(IF(AND(VLOOKUP(" & StrC & "!R[-11]C[-4],Werkvorm,5,0)="""",OR(" & StrC & "!R[-11]C[-3]=""Eerste kans""," & StrC & "!R[-11]C[-3]=""Herkansing""))," & StrC & "!R[-11]C[-3]&"" ""&INDEX(" & StrC & "!C[-3],LARGE(--(LEFT(" & StrC & "!R2C5:R[-11]C5,7)=""Cluster"")*ROW(" & StrC & "!R2C5:R[-11]C5),1)),TRIM(" & StrC & "!R[-11]C[-3]&"" ""&VLOOKUP(" & StrC & "!R[-11]C[-4],Werkvorm,5,0))),"""")"
Worksheets(StrC).Name = StrWs
Application.Calculation = xlCalculationAutomatic
End Sub
Voorbeeld:
Bekijk bijlage Matrix.xlsm
mvg
Kasper
Bijlagen
Laatst bewerkt: