Hello,
I have the code shown below which runs properly and fills in columns with a "0" if the search work (in cell I1) is not present in cell B2. I would like for the cells to display " - " instead of "0" but I get "Run-time error '13' Type Mismatch". Can anyone explain why or how to accomplish this please?
Thanks!
I have the code shown below which runs properly and fills in columns with a "0" if the search work (in cell I1) is not present in cell B2. I would like for the cells to display " - " instead of "0" but I get "Run-time error '13' Type Mismatch". Can anyone explain why or how to accomplish this please?
Code:
LastRow = Worksheets("Filtered Data").Range("B" & Rows.Count).End(xlUp).Row
'THIS CODE BELOW POPULATES WITH "0" AND WORKS FINE
Worksheets("Filtered Data").Range("I2:I" & LastRow).Formula = "=IFERROR(IF(SEARCH(I$2,$B2)>0,I$1,),)"
'THIS CODE BELOW DOES NOT WORK AND RESULTS IN RUN-TIME ERROR
Worksheets("Filtered Data").Range("I2:I" & LastRow).Formula = "=IFERROR(IF(SEARCH(I$1,$B2)>0,I$1,)," - ")"