Hi,
I am supposed to write a macro for work and until I get more familiar with VBA I decided to just write one that did something simple.
By using the Record Macro and some example scripts I got some of it down. But for some reason my code doesn't work. Here's what I have:
Option Explicit Sub Addition() Dim Add As Integer Dim var1 As Integer Dim var2 As Integer var1 = Range("A2").Select var2 = Range("B2").Select Add = var1 + var2 Range("C2").Select ActiveCell.FormulaR1C1 = Add End Sub
It displays -2 in cell 'C2' instead of the correct answer which would be 30
(A2 = 20, B2 = 10)