View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
K Dales[_2_] K Dales[_2_] is offline
external usenet poster
 
Posts: 1,163
Default Range - Application Defined or Object Defined Error

Should work, but what is the value of TotalNames?
Note that if your calculated range goes beyond the row/column limitations of
an Excel spreadsheet it will be unable to evaluate the range and you will get
the error you describe. Limits are 65,536 rows by 256 columns. So if
TotalNames is, say, 65535 then Cells(TotalNames + 3, 1) is out of bounds.
--
- K Dales


"Dyl" wrote:

Hello,

I am having a problem with declaring a range object. The code which I
receive the Application/Object Defined error for is

Set myRange2 =
ThisWorkbook.Worksheets("Procedures").Range(Cells( TotalNames + 3, 1),
Cells(TotalNames + 3, 2))

I am frustrated because I have a line of code in my program which does
work and is almost identical.

Set myRange = ThisWorkbook.Worksheets("Procedures").Range(Cells( 2,
NumberofBuilds + 2), Cells(3, NumberofBuilds + 2))



I am unclear of how to use Range syntax, but I am comfortable referring
to cells using cell index numbers. Any help or reccomendations would
be appreciated.

Thanks for your time.

Dylan H