Out of Memory Message

edrobyn

New Member
Joined
Jul 22, 2011
Messages
25
Hello,

I am getting an out of memory message when I try to run a macro and the debugger is highlighting this command line below. Is this line too long? If so, is there a way to split it and still work?

I started out with a smaller command list and since I have expanded it it gives me this error message. I have several different other data types and I only need to sum the ones listed below and not the others.

Can you show me how to fix this?

Thanks.

.Range("B2:B" & Lastrow).FormulaR1C1 = "=SUMPRODUCT(--(" & strRngA & "=RC1),--(" & strRngB & "=""Collar Sensor""))+" _
& "SUMPRODUCT(--(" & strRngA & "=RC1),--(" & strRngB & "=""SideSensor NoBag""))+" _
& "SUMPRODUCT(--(" & strRngA & "=RC1),--(" & strRngB & "=""SideSensor Baggd""))+" _
& "SUMPRODUCT(--(" & strRngA & "=RC1),--(" & strRngB & "=""JeansPantsDresses""))+" _
& "SUMPRODUCT(--(" & strRngA & "=RC1),--(" & strRngB & "=""SensorBagsPurses""))+" _
& "SUMPRODUCT(--(" & strRngA & "=RC1),--(" & strRngB & "=""Sensor Seat Belt""))+" _
& "SUMPRODUCT(--(" & strRngA & "=RC1),--(" & strRngB & "=""SensorLeatherBelt""))+" _
& "SUMPRODUCT(--(" & strRngA & "=RC1),--(" & strRngB & "=""SensorElasticBelt""))+" _
& "SUMPRODUCT(--(" & strRngA & "=RC1),--(" & strRngB & "=""CutPlstcSideSnsrBg""))+" _
& "SUMPRODUCT(--(" & strRngA & "=RC1),--(" & strRngB & "=""RmvTcktApplyTckt""))+" _
& "SUMPRODUCT(--(" & strRngA & "=RC1),--(" & strRngB & "=""CtPlstcSnsrSeatBlt""))+" _
& "SUMPRODUCT(--(" & strRngA & "=RC1),--(" & strRngB & "=""CtPlstcSnsrElasBlt""))+" _
& "SUMPRODUCT(--(" & strRngA & "=RC1),--(" & strRngB & "=""CtPlstcSnsrLthrBlt""))+" _
& "SUMPRODUCT(--(" & strRngA & "=RC1),--(" & strRngB & "=""TicketsApplied-CD""))+" _
& "SUMPRODUCT(--(" & strRngA & "=RC1),--(" & strRngB & "=""SensormaticApply""))"
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
If the code Rorya provided works,

Then try this

Code:
.Range("B2:B" & LastRow).FormulaR1C1 = _
   "=SUMPRODUCT(--(" & strRngA & "=RC1)--(ISNUMBER(MATCH(" & strRngeC & "," & strRngeB & ",0))))"

where strRngeC is a range containing all the strings you're looking for.
 
Upvote 0

Forum statistics

Threads
1,224,516
Messages
6,179,231
Members
452,898
Latest member
Capolavoro009

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