-
Assign Formula Result to variable
Sorry for such a beginner question, but all examples I have seen use strings.
My Goal is to assign the value returned by a formula to a variable, and then set a cell equal to the value of the variable.
The formula I am using returns a value of 10.
[VBA]
Sub GetPrice()
Dim StockNum As Integer
'These two lines result in "0" being placed in Cell E6
StockNum = FormulaR1C1 = "=COUNTA(Main!R3C2:R3C11)"
Range("Main!E6").Value = StockNum ' "Why does make the Cell "0" and not "10" ?
'This line results in "10" being places in Cell E7
Range("Main!E7").FormulaR1C1 = "=COUNTA(Main!R3C2:R3C11)"
End Sub
[/VBA]
Thank you for you help.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules