Thread: insert formula
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default 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