I found this piece of code on the web to verify whether or not a named range exists.I use it like thisCode:Function NameExists(TheName As String) As Boolean On Error Resume Next NameExists = Len(ThisWorkbook.Names(TheName).Name) <> 0 End FunctionBut, it always returns False even when the range does exist.Code:If NameExists("PYAcuteBase") = True Then Wkb1.Sheets("HFR Setting").Range(pyactuebase).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:= _ False, Transpose:=False Else Wkb1.Sheets("HFR Setting").Range("E16").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:= _ False, Transpose:=False End If
I just need to know if a range name exists...if it does, then I want to use it. If it doesn't, not big deal, I will just hard code the cell location I want.



Reply With Quote


Bookmarks