Naming a range


Posted by mike on July 21, 2000 6:48 AM

This code finds a range then names it...


Do Until ActiveCell = "70 New"
ActiveCell.Offset(1, 0).Select
Loop
ActiveCell.Offset(-1, 0).Select
Range(ActiveCell, ActiveCell.End(xlUp)).EntireRow.Select
ActiveWorkbook.Names.Add Name:="adam", RefersToR1C1:= _
"=offset(exception!R1C1,0,0,COUNTA(EXCEPTION!C1),COUNTA(EXCEPTION!R1))"
Application.Goto REFERENCE:="adam"

the line with "=offset..." is wrong!!!!!! what goes in there. THANKS!

Posted by Ada on July 21, 0100 7:07 AM


Mike
See if this works and does what you want (I'm not sure if it will) :-

ActiveWorkbook.Names.Add Name:="adam", RefersTo:="=offset(exception!$A$1,0,0,COUNTA(EXCEPTION!$A:$A),1)

Ada

Posted by mike on July 21, 0100 7:12 AM

It works only for column A.. i need it to select the entire row for all the cell selected in A

Posted by mike on July 21, 0100 7:16 AM

This is selecting all of column A. i only want it to name what is already selected.. check back to the original post to see



Posted by Ivan Moala on July 21, 0100 3:01 PM

Mike
if you only want it to name what is already selected
then try;
ActiveWorkbook.Names.Add Name:="adam", RefersToR1C1:=Selection


Ivan

Or is there some reason you want to use the
offset function ???