Macros have a similarity to Algebra. If you don't know Algebra, learning Macros will be harder.
x = 3 + 2 We know that x = 5 7 = x + 2 We know that x = 5 We subtract 2 from both sides of the equation 7 - 2 = x + 2 - 2 and get 5 = x + 0 and since x + 0 = x we can write 5 = x we can flip it around and get x = 5 So algebra has the concept of variables and so does computer programming. In algebra, we "solve" for the variable, but in programming, a variable is memory storage that allows the program to recall a variable's value. The = in algebra is different from the = in programming. In algebra it means equality. The values on the left are equal to the values on the right. In programming, in VBA it means 2 things. The programming statement x = x + 1 is impossible in algebra. But it tells Excel to calculate the value on the left and assign it to the variable x. So if x is 0 then after the statement is executed it will be 1. If we run the statement again x will be 2. You can't write x + 1 = x because this is considered a syntax error and Excel will show a message
|