View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
[email protected] programmernovice@yahoo.com is offline
external usenet poster
 
Posts: 21
Default VB Syntax for OFFSET statement


Stefano Gatto wrote:
Try

Names("rows").Value

to get 3 out of your name

--
Stefano Gatto


"Jake Marx" wrote:

Hi,

wrote:
Hi, I have defined a name in a worksheet to refer to a number. For
example the name "rows" refers to 3. How can I use the name within an
OFFSET statement in a VB macro? I have tried different forms of
OFFSET("rows",7) or OFFSET("=rows",7), or OFFSET(range("rows"),7),
etc. Nothing seems to work.


Range("rows").Value should work fine. But Offset is a method that must be
applied to an object - in this case a Range object. So your code would be
something like this:

MsgBox Range("A10").Offset(Range("rows").Value, 0).Address

Should give you A13.

--
Regards,

Jake Marx
www.longhead.com


[please keep replies in the newsgroup - email address unmonitored]


Thanks, Jake and Stefano,you all are very helpful, that's what I
needed.