Please Help - Formula Reset Won't Work

throtmorton

Board Regular
Joined
Aug 9, 2005
Messages
94
Office Version
  1. 365
Platform
  1. Windows
Howdy,

I can't get this formula reset to work. It works fine as a function, and I've tested to make sure the range is correct.

Can anyone tell me what I'm doing wrong?

Thanks!
Paul


Sub TestReset()
Range("TestRange").Formula = "=IF(OR(E$37=0,E$37=""),E267*E333,IF(OR(AND(E$37=90,$BM199<4),AND(E$37=60,$BM199<3),AND(E$37=30,$BM199<2)),0,IF(E$37=30,E266*E332,IF(E$37=60,E265*E331,E264*E330))))"
End Sub
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
your missing a double quotation mark in the formula
Rich (BB code):
Sub TestReset2()
Range("testrange").Formula = "=IF(OR(E$37=0,E$37=""""),E267*E333,IF(OR(AND(E$37=90,$BM199<4),AND(E$37=60,$BM199<3),AND(E$37=30,$BM199<2)),0,IF(E$37=30,E266*E332,IF(E$37=60,E265*E331,E264*E330))))"
End Sub
 
Upvote 0
Michael,

Thanks! Works like a charm.

Didn't know I needed to double down on the quotation marks.

Regards,
Paul
 
Upvote 0
Yep, anytime you put a formula with quotation marks into VBA you'll need to double 'em.
 
Upvote 0

Forum statistics

Threads
1,224,613
Messages
6,179,896
Members
452,948
Latest member
Dupuhini

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