LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Error inserting formulas into a range object


Greetings all,

I am receiving an 'Application-defined or Object-defined' Run-time
error on some simple code but I can not for the life of me get it to
work. I am using 2003 and trying to just insert a formula into a
selected range of rows down a column.


Code:
--------------------

Dim cell As Range

Sub insertLineSellFormula()
For Each cell In Selection
cell.Formula = "=OFFSET(" & cell.Address & ",0,-2)/(1-OFFSET(" & cell.Address & ",0,-1)"
Next cell
End Sub
--------------------

Oddly enough I can reference the cell object to alter other properties
of it within the loop (clear it, apply conditional formats, ect.) but
when I attempt to insert the formula or a .Value I get the run-time
error.

As always any insight you guys may have is very much appreciated.

Thanks!


--
Josh22
------------------------------------------------------------------------
Josh22's Profile: http://www.excelforum.com/member.php...o&userid=24080
View this thread: http://www.excelforum.com/showthread...hreadid=393114

 
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
Macro error, range object need data? Daniel Charts and Charting in Excel 1 June 15th 07 11:27 AM
Object range method runtime error Neal Zimm Excel Programming 3 April 8th 05 02:47 AM
Range Question / error 1004: method Range of object Worksheet has failed Paul Excel Programming 3 April 7th 05 02:56 PM
Adding named range gives error "method range of object _Global failed " Gunnar Johansson Excel Programming 3 August 10th 04 01:54 PM
Range object failed - random error Lenny[_2_] Excel Programming 0 August 15th 03 02:10 AM


All times are GMT +1. The time now is 11:18 PM.

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

About Us

"It's about Microsoft Excel"