Excel VBA FormulaR1C1 Error 1004

Squareroot

New Member
Joined
Nov 9, 2022
Messages
15
Office Version
  1. 2021
Platform
  1. Windows
Hi,
I am getting 1004 error for the following code, i have checked through many time and still unsure why..

ActiveCell.FormulaR1C1 = "=IF(" & buffer2(0) & "=""yes"",IF(" & buffer2(1) & "=0," _
& buffer2(2) & "*0.07,SUMPRODUCT(" & buffer2(1) & "," & buffer2(3) & ") * 0.07),0)"
 
What happened when you used my suggestion to replace buffer2(1) with buffer2(1).Address(,,xlR1C1)
It gives me following result:
=IF($H$2="yes",IF($I$2=0,SUMPRODUCT($F$2,$J$2) * 0.07,SUMPRODUCT($I$2,$J$2) * 0.07),0)
which is similar to what i wanted. i just did some modification to the code to remove the $ sign.
 
Upvote 0

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top