Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 161
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 161
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert formula John Excel Discussion (Misc queries) 3 May 25th 10 04:25 PM
insert formula [email protected] Excel Programming 3 May 17th 06 11:06 PM
Insert a value into formula Ed Excel Discussion (Misc queries) 5 April 16th 06 06:25 AM
insert formula [email protected] Excel Programming 1 August 16th 05 07:27 PM
Insert Formula Kevin Excel Programming 4 September 10th 04 04:56 PM


All times are GMT +1. The time now is 10:21 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"