View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Setting a formula using VBA

PNLWorksheet.Cells(lngDown, 9).Formula = "=" & _
"Sum(A1:A10)"

should work. If you want to express the formula in R1C1 terms

PNLWorksheet.Cells(lngDown, 9).FormulaR1C1 = "=" & _
"Sum(R1C1:R10C1)"

If you have a version other than English and want to use the same
terminology as would be used manually, then use

FormulaLocal
or
FormulaR1C1Local



--
Regards,
Tom Ogilvy


Phill wrote in message
...
How do I set a cell to be a formula using VBA? I have
tried the following:
PNLWorksheet.Cells(lngDown, 9).Formula = "=" &
PNLWorksheet.Cells(lngDown, 8).Value & "/" &
PNLWorksheet.Cells(lngDenominator, 8)