ranges as arrays

G

Guest

Is there a problem with:

Dim block(101) as Range

I've also tried block(), block(101), and still get object variable error
messages that point to the first time I try to assign the range block(i).
In my worksheet I have blocks of data of some 50 lines where the data in the
block is from a common date. I have operations I want to perform on each
block of data as a block. My idea was to define each block of common date as
a range, do my calculations on the block, then iterate to the next date code.
 
G

Guest

Sub aa1()
Dim block(101) As Range
For i = 0 To 101
Set block(i) = Range("A1").Offset( _
Int(Rnd() * 100 + 1), Int(Rnd() * 100 + 1)) _
.Resize(Int(Rnd() * 100 + 1), Int(Rnd() * 100 + 1))
Next
End Sub

worked fine for me. Just as a demonstration.
 
G

Guest

Thank you. I was trying "block(i)=range....", instead of "set
block(i)=range(....."
Sorry for the stupid question, but thanks for the good answer.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top