John,
try this,
Sub DoIt()
On Error GoTo RngError
Range("anchor").Select
Exit Sub
RngError:
Application.Goto Reference:=Range("A1")
Exit Sub
End Sub
Regards
Neil
"John Wirt" <someone@d.com> wrote in message
news:ekucP0pAFHA.2552@TK2MSFTNGP09.phx.gbl...
> The following code is written to test for the existence of a cell named
> "anchor" on the Active Sheet but it does not work. If the named cell
> exists,
> that named range is supposed to become the active cell.
>
> Something is wrong with the second statement. Even if a cell named
> "anchor"
> exists on the active sheet, the resulting CellName is Nothing. Why?
>
> Dim CellName as Name
>
> On Error Resume Next
> Set CellName = ActiveSheet.Names("anchor").Name
> On Error GoTo 0
> If Not CellName Is Nothing Then
> Application.Goto Reference:=CellName
> Else
> Application.Goto Reference:=Range("A1")
> End If
>
> Thank you.
>
> John Wirt
>
>
Bookmarks