I was playing around with Excel to try and help out a friend with a problem, and wrote the following macro
Sub test()
Worksheets("Sheet3").Cells(1, 4) = "=SUM(A1:A2)"
End Sub
The idea was to try and figure out if I could create a macro that writes formulas in a specific cell (which we know we could) but also be able to change the range of the formula.
For example, if instead of just 2 values to sum up, I had 4 values, we want the macro to the able to count all the values and then set a range for all the formulas.
The problem here is that when I write the piece of code shown above, for some reason in the cell it appears " =@SUM(A1:A2)
". I have no idea what the "@" symbol is supposed to do nor why it is showing up. As a result though, I get a "name?" error and the function doesn't work. However, if I manually delete the "@" symbol, it works perfectly.
Can anyone explain why the "@" symbol is showing up and how not make it show up ?