Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
insert formula
I have this code to enter a formula into a cell:
Dim lcell As String Dim rng as range lcell = Sheets("Estimates").Range("estdbcboxlnkcell").Offs et(estnum, 0).Address rng.FormulaR1C1 = "=if(" & lcell & ",RC[-2],0)" I get an error message when it is run. What am I doing wrong? Thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
insert formula
..Address returns the address in A1 reference style. You want to use R1C1
reference style. lcell = Sheets("Estimates").Range("estdbcboxlnkcell") _ .Offset(estnum, 0).Address(ReferenceStyle:=xlR1C1) ranswert wrote: I have this code to enter a formula into a cell: Dim lcell As String Dim rng as range lcell = Sheets("Estimates").Range("estdbcboxlnkcell").Offs et(estnum, 0).Address rng.FormulaR1C1 = "=if(" & lcell & ",RC[-2],0)" I get an error message when it is run. What am I doing wrong? Thanks -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
insert formula
Worked great
Thanks You "Dave Peterson" wrote: ..Address returns the address in A1 reference style. You want to use R1C1 reference style. lcell = Sheets("Estimates").Range("estdbcboxlnkcell") _ .Offset(estnum, 0).Address(ReferenceStyle:=xlR1C1) ranswert wrote: I have this code to enter a formula into a cell: Dim lcell As String Dim rng as range lcell = Sheets("Estimates").Range("estdbcboxlnkcell").Offs et(estnum, 0).Address rng.FormulaR1C1 = "=if(" & lcell & ",RC[-2],0)" I get an error message when it is run. What am I doing wrong? Thanks -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Insert formula | Excel Discussion (Misc queries) | |||
insert formula | Excel Programming | |||
Insert a value into formula | Excel Discussion (Misc queries) | |||
insert formula | Excel Programming | |||
Insert Formula | Excel Programming |