I have the following formula which works well for me, but I don't want the complete formula to be shown. I just want the result to be shown. How can I do it?
This is my code which works fine:
Dim LastR As Integer
With Worksheets("DashBoard")
LastR = .Cells(Rows.Count, "C").End(xlUp).Row
.Range("D9").FormulaArray = "=SUM(IF(StoreData!$A$2:$A$10000=$E$3,IF(YEAR(StoreData!$C$2:$C$10000)=C9,StoreData!$B$2:$B$10000)))"
.Range("D9").AutoFill Destination:=.Range("D9:D" & LastR)
End With
I made this other code so that it only shows the result of the formula, but when I run it, all cells have the same value.
Dim Hjs As Worksheet
Set Hjs = ActiveSheet
With Hjs.Range("D9:D" & Hjs.Cells(Rows.Count, "C").End(xlUp).Row)
.FormulaArray = "=SUM(IF(StoreData!$A$2:$A$10000=$E$3,IF(YEAR(StoreData!$C$2:$C$10000)=C9,StoreData!$B$2:$B$10000)))"
.Value = .Value
End With
I only want the result of the formula to be displayed.