Hi,
I want to calculate a figure and store the answer as a variable to then be used later in the code. At the moment I have the formula, but obviously, it puts this into the cells I have specified rather than storing it in the memory.
So instead of the result of the sumif populating in Z1, I want the answer to be stored for use later.
Do you know how I can do this? Struggling to find answers on google...
Thanks!
I want to calculate a figure and store the answer as a variable to then be used later in the code. At the moment I have the formula, but obviously, it puts this into the cells I have specified rather than storing it in the memory.
Code:
Dim Data As Workbook
Set Data = Workbooks("Data Today")
Data.Activate
Range("Z1").Formula = "=SUMIFS(K:K,A:A,""Apples"")"
Range("Z2").Formula = "=SUMIFS(K:K,A:A,""Oranges"")"
So instead of the result of the sumif populating in Z1, I want the answer to be stored for use later.
Do you know how I can do this? Struggling to find answers on google...
Thanks!