Home » excel » EXCEL VBA run formula via MACRO

EXCEL VBA run formula via MACRO

Posted by: admin April 23, 2020 Leave a comment

Questions:

I had already asked a question like this before but I’m really bad at VBA formula.

Here is my formula:

Worksheets("Sheet1").Range(CellRange).formula = "=IF(Sheet2!E$4=X;CONCATENATE(Sheet3! """ & myString """, Not defined)"

Run-time error 1004: error defined by the application or object

myString is a STRING and contains the address of a cell.

I’ve used to follow the explanation from my previous question A question with a really good answer

But It didn’t worked this time. Any suggestions?

Thank you!

How to&Answers:
Worksheets("Sheet1").Range(cellrange).Formula = _
  "=IF(Sheet2!E$4=""X"",Sheet3!" & myString & ", ""Not defined"")"