New Contributor

# macro command for function key F9

Hello

I recorded a macro in Excel, one of the commands recorded in the macro was to calculate a formula (function key F9).

When I opened the macro for editing, this was the line that appeared in the editor:

ActiveCell.FormulaR1C1 = "2000"

("2000" is the calculated value of this particular formula - so written as an absolute value, instead of a command to calculate formula (F9).

is there any way to write/record this command in macro (Excel)?

TNX

3 Replies

# Re: macro command for function key F9

If you want to recalculate the active cell:

ActiveCell.Calculate

If you want to recalculate all cells in the current selection:

Selection.Calculate

If you want to recalculate the active worksheet:

ActiveSheet.Calculate

If you want to recalculate the workbook:

ActiveWorkbook.Calculate

If you want to recalculate all open workbooks:

Application.Calculate

# Re: macro command for function key F9

Hi,

Thank you!!!

sadly Im still having trouble with that (sorry, just beginner...)

I'm not sure what's the Command syntax.

this in my Macro:

ActiveCell.FormulaR1C1 = "The price is set"
ActiveCell.Offset(0, 8).Range("A1").Select
ActiveCell.FormulaR1C1 = "2000"
ActiveCell.Offset(0, -8).Range("A1").Select

End Sub

The yellow line is my problem...

can you please show me the full syntax in order to calculate the selected cell?

TNX

# Re: macro command for function key F9

If both the active cell and the cell 8 columns to the right contain formulas:

``````    ActiveCell.Calculate
ActiveCell.Offset(0, 8).Calculate``````