0
0
Excelspreadsheet~10 mins

Simple VBA procedures in Excel - Cell-by-Cell Formula Trace

Choose your learning style9 modes available
Sample Data

Column A has numbers. Column B is empty and will be filled by a VBA procedure that doubles the values in column A.

CellValue
A15
A210
A315
B1
B2
B3
Formula Trace
Sub DoubleValues() Range("B1").Value = Range("A1").Value * 2 Range("B2").Value = Range("A2").Value * 2 Range("B3").Value = Range("A3").Value * 2 End Sub
Step 1: Range("A1").Value
Step 2: Range("A1").Value * 2
Step 3: Range("B1").Value = 10
Step 4: Range("A2").Value
Step 5: Range("A2").Value * 2
Step 6: Range("B2").Value = 20
Step 7: Range("A3").Value
Step 8: Range("A3").Value * 2
Step 9: Range("B3").Value = 30
Cell Reference Map
    A     B
  +-----+-----+
1 |  5  |     |  <-- B1 will get A1*2 = 10
  +-----+-----+
2 | 10  |     |  <-- B2 will get A2*2 = 20
  +-----+-----+
3 | 15  |     |  <-- B3 will get A3*2 = 30
  +-----+-----+
Cells in column A are read and their values doubled into column B.
Result
    A     B
  +-----+-----+
1 |  5  | 10  |
  +-----+-----+
2 | 10  | 20  |
  +-----+-----+
3 | 15  | 30  |
  +-----+-----+
After running the VBA procedure, column B shows doubled values of column A.
Sheet Trace Quiz - 3 Questions
Test your understanding
What value will cell B2 have after running the VBA procedure?
A15
B10
C20
D30
Key Result
Simple VBA procedure reads cell values, performs arithmetic, and writes results to other cells.