View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default How to return a Range object


How about
dim myRange as range
dim Var1 as range
set myrange = activesheet.range("A1:z99")
set var1 = myrange.cells(1)

You declared var1 as a variant. And you didn't use "Set", so VBA thought you
wanted the default property of the range.





maweilian wrote:

Another newbie question:

For the following:
Dim myRange as Range, var1
var1 = myRange.Item(1)

MyRange.Item(1) returns a Variant/Double. How can I get it to return a
range object representing a single cell?

Thanks,
Will


--

Dave Peterson