cnatac2000
New Member
- Joined
- Sep 15, 2020
- Messages
- 9
- Office Version
- 2010
- Platform
- Windows
I have this Excel Array Formula. It works on the Actual Excel worksheet. However, when I tried to transfer it to VBA Excel, it gives me this error Run time error 1004". I normally creates fhe formula first to make sure it works then transfer it to VBA Excel, that I can include as part of the module
This formula matches code 3987 and amounts$3,988.19 to the Deposit List. The formula considers any amount less than the threshold of $300 under B7 as a match.
A7 contains code 3987
B7 Contains amount $3,988.19
C7 - contains amount $300 used as threshold
This is the deposit list
Deposit!G7:G19 - contains deposit code which include 3987
Deposit!F7:F19- Contains dollar amount the nearest amount is 3,911.87 under row 14
This formula works on D7 but I could not transfer it to Excel VBA
Sheets("Deposit").Range("D7").FormulaArray = _
"=IFERROR(IFERROR(MATCH(Deposit!A7&Deposit!B7,Deposit!G7:G19&Deposit!F7:F19,0)+6,(MATCH(1,(Deposit!G7:G19&Deposit!F7:F19>(Deposit!A7&Deposit!B7-C7))*(Deposit!G7:G19&Deposit!F7:F19<Deposit!A7&Deposit!B7+C7),0)+6)),0)"
I am baffled about how to transfer this to VBA Excel.
Any help will be greatly appreciated.
This formula matches code 3987 and amounts$3,988.19 to the Deposit List. The formula considers any amount less than the threshold of $300 under B7 as a match.
A7 contains code 3987
B7 Contains amount $3,988.19
C7 - contains amount $300 used as threshold
This is the deposit list
Deposit!G7:G19 - contains deposit code which include 3987
Deposit!F7:F19- Contains dollar amount the nearest amount is 3,911.87 under row 14
This formula works on D7 but I could not transfer it to Excel VBA
Sheets("Deposit").Range("D7").FormulaArray = _
"=IFERROR(IFERROR(MATCH(Deposit!A7&Deposit!B7,Deposit!G7:G19&Deposit!F7:F19,0)+6,(MATCH(1,(Deposit!G7:G19&Deposit!F7:F19>(Deposit!A7&Deposit!B7-C7))*(Deposit!G7:G19&Deposit!F7:F19<Deposit!A7&Deposit!B7+C7),0)+6)),0)"
I am baffled about how to transfer this to VBA Excel.
Any help will be greatly appreciated.