View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
François François is offline
external usenet poster
 
Posts: 40
Default Working with range

Thanks Tom.
The purpose of using a range rather than using a logic like
activecell.(offset(0,1)) etc was to save some process time. Purpose is to
retrieve the colors of each cell of a range ("a2:n81") stored in one
worksheet and to copy some cells to another worksheet.
But I can not do :
Dim ThisRange as Range
ThisRange = Range("A2:N81") cause this is giving a runtime error.
Why ?

Thanks.


"Tom Ogilvy" wrote:

demo't from the immediate window:

ThisRange = Range("A2:N81").Value
? lbound(thisrange,1), ubound(thisrange,1)
1 80
? lbound(thisrange,2), ubound(thisrange,2)
1 14



--
Regards,
Tom Ogilvy

"François" wrote in message
...
Hello

I have some problems dealing with the arrays.
Here the code

ThisRange = Range("A2:N81")
It supposed to be a array of 2 dimensions of type variant
So If I do uBound(ThisRange) I get 80 which seems to be right (80 rows).
But if I asked uBound(ThisRange(1)) which is supposed to give me the

number
of elements coming from the columns I get an error 9 "Subscript out of

range".

What is wrong in my code ?

Thanks
François