Tip:
when you want to add a name for a (complex) multiarea range
you may easily run into problems because the str
cannot exceed 255 chars.
By assigning the Name property of the Range Object
you circumvent the problem..
activesheet.Cells.SpecialCells(x).Name = "Gotcha"
or Range(x).Name = "Gotcha2"
--
keepITcool
|
www.XLsupport.com | keepITcool chello nl | amsterdam
Tom Ogilvy wrote :
Demo'd from the immediate window:
j = 21
strCol = "F"
strName = "ABCD"
ActiveWorkbook.Names.Add Name:=strName, RefersTo:= _
"=" & Range(strCol & "2:" & strCol & _
j).SpecialCells(xlCellTypeVisible).Address
' now lets have a look at the results:
? activeworkbook.Names("ABCD").RefersTo
=Sheet2!$F$2:$F$21
So it all lined up for me with the range refering to the activesheet
when the code was run.