Excel vb =sum(--(mmult((

boazz

New Member
Joined
Mar 27, 2014
Messages
3
Sub COPYonRowsAndColumns()
' PLEASE help me to make this easier
Range("BB1").Select
ActiveCell.FormulaR1C1 = _
"=SUM(--(MMULT((RC11:RC12=R88C54)+(RC11:RC12=R88C55),{1;1})=2))"

' =SUM(--(MMULT(($K1:$L1=$BB$88)+($K1:$L1=$BC$88),{1;1})=2)) ' inside cell
Selection.AutoFill Destination:=Range("BB1:BB6"), Type:=xlFillCopy
Range("BB1:BB6").Select
Range("BB1").Select
Selection.AutoFill Destination:=Range("BB1:BC1"), Type:=xlFillCopy
Range("BB1:BC1").Select

Range("BC1").Select
ActiveCell.FormulaR1C1 = _
"=SUM(--(MMULT((RC11:RC12=R89C54)+(RC11:RC12=R89C55),{1;1})=2))"
' =SUM(--(MMULT(($K1:$L1=$BB$89)+($K1:$L1=$BC$89),{1;1})=2)) ' inside cell
Selection.AutoFill Destination:=Range("BC1:BC6"), Type:=xlFillCopy
Range("BC1:BC6").Select
Range("BC1").Select
Selection.AutoFill Destination:=Range("BC1:BD1"), Type:=xlFillCopy
Range("BC1:BD1").Select

Range("BD1").Select
ActiveCell.FormulaR1C1 = _
"=SUM(--(MMULT((RC11:RC12=R90C54)+(RC11:RC12=R90C55),{1;1})=2))"
'=SUM(--(MMULT(($K1:$L1=$BB$90)+($K1:$L1=$BC$90),{1;1})=2)) ' inside cell
Selection.AutoFill Destination:=Range("BD1:BD6"), Type:=xlFillCopy
Range("BD1:BD6").Select
Range("BD1").Select
Selection.AutoFill Destination:=Range("BD1:BE1"), Type:=xlFillCopy
Range("BD1:BE1").Select
Range("BE1").Select
ActiveCell.FormulaR1C1 = _
"=SUM(--(MMULT((RC11:RC12=R91C54)+(RC11:RC12=R91C55),{1;1})=2))"
' =SUM(--(MMULT(($K1:$L1=$BB$91)+($K1:$L1=$BC$91),{1;1})=2)) ' inside cell
Selection.AutoFill Destination:=Range("BE1:BE6"), Type:=xlFillCopy
Range("BE1:BE6").Select
Range("BE6").Select

Thank you .
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
This is a simplified version of your code:
Code:
Range("BB1") = "=SUM(--(MMULT((RC11:RC12=R88C54)+(RC11:RC12=R88C55),{1;1})=2))"
Range("BC1") = "=SUM(--(MMULT((RC11:RC12=R89C54)+(RC11:RC12=R89C55),{1;1})=2))"
Range("BD1") = "=SUM(--(MMULT((RC11:RC12=R90C54)+(RC11:RC12=R90C55),{1;1})=2))"
Range("BE1") = "=SUM(--(MMULT((RC11:RC12=R91C54)+(RC11:RC12=R91C55),{1;1})=2))"

Range("BB1:BE1").Copy
Range("BB1:BE6").PasteSpecial Paste:=xlPasteFormulas
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,207
Members
452,618
Latest member
Tam84

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