Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / March 2008

Tip: Looking for answers? Try searching our database.

insert formula

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ranswert - 19 Mar 2008 00:08 GMT
I have this code to enter a formula into a cell:

Dim lcell As String
Dim rng as range
lcell = Sheets("Estimates").Range("estdbcboxlnkcell").Offset(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 - 19 Mar 2008 00:43 GMT
.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)

> I have this code to enter a formula into a cell:
>
[quoted text clipped - 6 lines]
> I get an error message when it is run.  What am I doing wrong?
> Thanks

Signature

Dave Peterson

ranswert - 19 Mar 2008 01:01 GMT
Worked great
Thanks You

> ..Address returns the address in A1 reference style.  You want to use R1C1
> reference style.
[quoted text clipped - 12 lines]
> > I get an error message when it is run.  What am I doing wrong?
> > Thanks
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.