View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Barb Reinhardt Barb Reinhardt is offline
external usenet poster
 
Posts: 3,355
Default what wrong here, range Cell as counter

Cell is already used within VBA, so I'd avoid it.

Dim myCell as Excel.Range

Dim Myrange as Excel.range,
Dun Anotherrange as Excel.Range

Set Myrange=(whatever))
Set Anotherrange= a range with offsets of cell
etc.
Dim Subrange(100) as Range

myCount = 0
For Each myCell in MyRange
'Not sure what you're trying to do here.
'Let us know and we can help some more
myCount = myCount + 1
Set AnotherRange = myCell.offset(1,0) '<~~~do what you want here
Set Subrange(myCount)=Union(AnotherRange, YetAnotherrange, AndAnotherrange)
Next myCells

HTH,
Barb Reinhardt

"John" wrote:

In the range, MYRange I want each cell to have it's own little subrange
to search. I try and do it below.

When it gets to Subrange(cell)= it uses the value of cell instead of
cell as a range and delivers an out of range error (or identifies the
incorrect range using the Cell value).

Thanks

John

-------------------------
Dim Cell as Range

Dim Myrange as range, Anotherrange as Range etc.

Set Myrange=(whatever))
Set Anotherrange= a range with offsets of cell
etc.
Dim Subrange(100) as Range

For Each Cell in MyRange
Subrange(Cell)=Union(AnotherRange, YetAnotherrange, AndAnotherrange)
Next