robertsfd
Technical User
- Apr 18, 2003
- 40
I have a macro that requests input from a user, stores in one column (column A), and another column (column B)calculates a formula based on that input value. I want a message box to then report both the user input value in column A and the calculated value in column B. Each time the macro runs, it moves to a new row and does the same thing.
I can get the user input value, but am unsure of how to "get" the value in that calculated cell (in column B) since it is not a static cell reference - instead it is a static column reference but the row reference would change each time the macro is run.
Thanks in advance. Doug
Here is what I have, but it doesn't work:
I can get the user input value, but am unsure of how to "get" the value in that calculated cell (in column B) since it is not a static cell reference - instead it is a static column reference but the row reference would change each time the macro is run.
Thanks in advance. Doug
Here is what I have, but it doesn't work:
Code:
' get input and place in current cell
ActiveCell.FormulaR1C1 = InputBox("Input your value")
' place current cell value in variable1
variable1 = ActiveCell.FormulaR1C1
' get value in adjacent cell and put in variable2 - THIS IS WHAT DOESN'T WORK
variable2 = cel.Offset(0,1)
'display ending message
MsgBox ("Your value was " & variable1 & "which calculates to " & variable2 & "units")