Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Setting a formula using VBA
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) |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Setting a formula using VBA
Phill,
Try this: .FormulaR1C1 = "the formula you want" HTH Chris Hoffman "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) |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Setting a formula using VBA
Hi,
You can enter a formula in 2 ways : 1. a static formula Cells(1,1).FormulaLocal = "=" & Cells(1,2) & "/" & Cells(1,3) 2. a dynamic formula Cells(1,1).FormulaLocal = "=" & Cells(1,2).Address & "/" & Cells(1,3).Address I hope this helps --- Message posted from http://www.ExcelForum.com/ |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
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) |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Setting up a formula (when F2<11,000)=$25 | Excel Worksheet Functions | |||
Help with setting up a formula | Excel Discussion (Misc queries) | |||
Setting up a formula | Excel Worksheet Functions | |||
cancelling getpivot formula when setting formula outside pivot ta. | Excel Worksheet Functions | |||
Setting a value from a formula | Excel Programming |