Freedom Computers

RECORD MACROS


Macro recorder on

Hit F2 in the cell of interest

Hit return

Stop recording.


FORMULA STYLES

The recorder will record R1C1 formula style which is often useful for relative formula in Excel with VBA.


I.E. same formula in two styles:

Range("A1").Formula = "=B1"

Range("A1").FormulaR1C1 = "=R[0]C[1]"


You need to 'escape' the quotes, and also you should write to the Formula property:

Eg:

Sheets("CSSM Roster A5").[C11].Formula ="=IF(O5+1<>A11,""ERROR"",A11)"

NOT

Sheets("CSSM Roster A5").[C11] ="=IF(O5+1<>A11,""ERROR"",A11)"

EXCEL