View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Nick_F Nick_F is offline
external usenet poster
 
Posts: 17
Default VBA equivalent to =OFFSET(....

I want to create a range in VBA in a similar fashion to the worksheet
function OFFSET. E.g..

=Offset(MyNamedRange,10,1,0,-5)

Which would give me a 10 x 1 range, 5 columns to the left of
"MyNamedRange" (which is a single cell).

How would I do this in VBA? I intend to use this range and another
range in the VBA 'Intersect' function to create a third range.

My expereimental code is something like this (after declaring and
setting the various variables)...

TestVals = Application.Offset(Cyc.Range("CurrentPowerDist"), 0, -6, r,
0)
MaxVal = Cyc.Range("CurrentPowerDist").Offset(-2, -6)
MaxRng = Intersect(TestVals, MaxVal)

Thanks
Nick