Code to Insert Formula in Cell
Example: I have one file with 2 worksheets (A and B). I want to have the
following formula in cell B10 of worksheet B: If range name RANGE1 on
worksheet A = 12, then insert the following text - "this is a test";
otherwise, insert a 0.
I had:
Worksheets("B").Range("B10").Formula = "=if('A'!RANGE1="12","this is a
test",0)"
but kept getting error messages. Tried with and without all types of quotes
and multiple other things, but still got various error messages like
application defined error, syntax error, or range property, etc.
Am I reference this correctly (obviously not). Also, where would this go -
into the module for worksheet B? What type of declaration (calculate?); I
may not have that correct either (tried all different kinds).
Appreciate any help that can be provided. Thanks.
|