At first, I am trying to write a macro program which can let user use to find numbers that closest to a total target that input from user.
- in the first figure, the quantity column is presenting amounts for their own title respectively. Target is an input from user. the horizontal A,B,C,D is use to show user which Title used.
I get this error message after the file execution.
Any advice? Thanks...
Sub Option1()
Dim c As Long
For c = 5 To 8
Sheet1.Cells(5, c).FormulaArray = _
"=INDEX(MOD(INT((ROW(R2C2:INDEX(C2,2^ROWS(R2C2:R9C2)))-1)/2^(TRANSPOSE(MATCH(ROW(R2C2:R9C2),ROW(R2C2:R9C2)))-1)),2)*TRANSPOSE(R2C2:R9C2),MATCH(MIN(ABS(MMULT(MOD(INT((ROW(R2C2:INDEX(C2,2^ROWS(R2C2:R9C2)))-1)/2^(TRANSPOSE(MATCH(ROW(R2C2:R9C2),ROW(R2C2:R9C2)))-1)),2),R2C2:R9C2)-R1C5)),ABS(MMULT(MOD(INT((ROW(R2C2:INDEX(C2,2^ROWS(R2C2:R9C2)))-1)/2^(TRANSPOSE(MATCH(ROW(R2C2:R9C2),ROW(R2C2:R9C2)))-1)),2),R2C2:R9C2)-R1C5),0),0)"
Next c
End Sub