View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein \(MVP - VB\)[_1922_] Rick Rothstein \(MVP - VB\)[_1922_] is offline
external usenet poster
 
Posts: 1
Default Refer to 1 cell relative from named range

Relative to what? Any cell in Range("C1:F10")? What would that mean? A
specific cell in that range? Which one? How do you know which one? The
program can't read your mind, so you have to focus into *something* if you
want to offset from it to somewhere else.

Rick


"Bret Bernever" wrote in message
...
Try to retrieve thevalue from 1 cell relative from named range.
Something like this.

Sub test()
Set MyRange = Range("C1:F10")
MyNumber = MyRange.Offset(1, -2).Value
End Sub

However the offset method gives me an array back which is not what I
want. How can I retrieve the value from for example A1 or B1 or C1 with
a relative reference?
MyRange.Cells(1, -2) gives a runtime error. Any suggestions?