Inserting a SUMIFS formula using excel macro

coop123

Board Regular
Joined
Dec 18, 2018
Messages
66
Office Version
  1. 365
Hello

I have a sumifs formula as part of a macro code.

ActiveCell.FormulaR1C1 = _
"=SUMIFS(M12:M" & ListEnd & ", $A12:$A" & ListEnd & ",""Non EU"",N12:N" & ListEnd & ",""<10"")" 'Non EU Less than 10%

Column M is the range to sum, column A is first criteria range and column N is second criteria. I am using ListEnd to give me last row in the columns. It is used throughout macro.


When running it stops with error Application-Defined or Object-Defined error.

Can someone point out where I have made the mistake.

Thanks in advance.

coop123
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
You need to use Formula, not FormulaR1C1
 
Upvote 0
Solution
Hi Fluff

Thank you for your solution.
It fixed my problem and macro now works.

Thanks Again

Coop123
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,249
Messages
6,123,882
Members
449,130
Latest member
lolasmith

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