Convert Formula to VBA

joand

Active Member
Joined
Sep 18, 2003
Messages
267
I was wondering how to convert this formula to VBA. Anyone got ideas?


{=SUM(IF(Sheet1!$C$4:$C$1118=Sheet2!$B5,IF(Sheet1!$D$4:$D$1118=Sheet2!C$2,IF(Sheet1!$E$4:$E$1118=1,1,0))))}
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
The simpliest (and most amazing) way is to with the current formula cell selected
Turn on Record a Macro
Once you do simply (back on the worksheet) Press the F2 key (to go into Edit Mode);
then Immediately press enter to get out of Edit Mode.
Stop the Macro

Goto your VBE and view the code created...

Jim
 
Upvote 0
In the case of an Array formula you will need to replace the

ActiveCell.FormulaR1C1 =

with

ActiveCell.FormulaArray =

Jim
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,291
Members
452,902
Latest member
Knuddeluff

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