View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Alan Beban Alan Beban is offline
external usenet poster
 
Posts: 200
Default how do you name a range?

You can name a range on the worksheet by highlighting the range to be
named (e.g., A1:D10), clicking on the down-arrow just above Column A,
typing the name (e.g., myRange), and entering. You could then refer to
the range in VBA as Range("myRange"); i.e., Range("myRange").Address
would return $A$1:$D$10.

You can also name a range in VBA with something like
Range("A1:D10").Name = "myRange"; you could also refer to this range in
VBA as Range("myRange").

You can also set an Object Variable to refer to the range; e.g.,
Set myRange = Range("A1:D10"). You could refer to this range in VBA with
myRange; i.e., myRange.Address would return $A$1:$D$10.

Alan Beban

John wrote:
I'm very new. How do you name a range? Like give a cell or range a name
rather than use "a1" cells(1,1). All I could find was this:

ActiveWorkbook.Names.Add Name:="SecondTry", RefersToR1C1:= _
"=Sheet1!R8C2:R11C3"

I got this by using record macro. I don't understand it.

thanks

John