Summary
Copy a value to a cell in a worksheet.
Situation
You want to show the user some output.
Needs
A variable with a value in it. The row and column of the cell that the value will be copied into.
Provides
A happy user.
Action
Like this:
- Cells(THE ROW, THE COLUMN) = THE VALUE
Excel will copy THE VALUE into the cell with row THE ROW, and column THE COLUMN.
Explanation
Example:
- Cells(2, 2) = sTotal
You can output an expression, if you like:
- Cells(2, 2) = sTotal / sCount
For the row and column, you can use anything that will give you a number, including variables and expressions.
- sRow = 7
- Cells(sRow, 2) = sTotal
- Cells(sRow + 1, 2) = sCount
- Cells(sRow + 2, 2) = sTotal / sCount
Where referenced