![]() |
Application.Goto Reference gets error 1004
I get "Run-time error 1004, Reference is not valid" when I execute
Application.Goto Reference:="AccountAbbreviations" Selection.ClearContents The name "AccountAbbreviations" is, in fact, not defined. How can I check for not defined so that the code can continue? TIA, Phil |
Application.Goto Reference gets error 1004
One way:
Dim rTest As Range On Error Resume Next Set rTest = ActiveWorkbook.Names( _ "AccountAbbreviations").RefersToRange On Error GoTo 0 If Not rTest Is Nothing Then rTest.ClearContents In article , cellist wrote: I get "Run-time error 1004, Reference is not valid" when I execute Application.Goto Reference:="AccountAbbreviations" Selection.ClearContents The name "AccountAbbreviations" is, in fact, not defined. How can I check for not defined so that the code can continue? TIA, Phil |
Application.Goto Reference gets error 1004
Try
Application.Goto Range("AccountAbbreviations"),True Cordially, Chip Pearson Microsoft MVP Excel Product Group Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Wed, 24 Dec 2008 21:06:00 -0800, cellist wrote: I get "Run-time error 1004, Reference is not valid" when I execute Application.Goto Reference:="AccountAbbreviations" Selection.ClearContents The name "AccountAbbreviations" is, in fact, not defined. How can I check for not defined so that the code can continue? TIA, Phil |
Application.Goto Reference gets error 1004
On Dec 25, 12:42*am, JE McGimpsey wrote:
One way: * * Dim rTest As Range * * On Error Resume Next * * Set rTest = ActiveWorkbook.Names( _ * * * * * * "AccountAbbreviations").RefersToRange * * On Error GoTo 0 * * IfNotrTest Is Nothing Then rTest.ClearContents * *In article , *cellist wrote: I get "Run-time error 1004,Referenceisnotvalid" when I execute Application.GotoReference:="AccountAbbreviations" * * Selection.ClearContents The name "AccountAbbreviations" is, in fact,notdefined. How can I check fornotdefined so that the code can continue? TIA, Phil- Hide quoted text - - Show quoted text - thanks JE |
Application.Goto Reference gets error 1004
On Dec 25, 9:04*am, Chip Pearson wrote:
Try Application.Goto Range("AccountAbbreviations"),True Cordially, Chip Pearson Microsoft MVP * *ExcelProduct Group Pearson Software Consulting, LLCwww.cpearson.com (email on web site) On Wed, 24 Dec 2008 21:06:00 -0800, cellist wrote: I get "Run-time error 1004,Referenceisnotvalid" when I execute Application.GotoReference:="AccountAbbreviation s" * *Selection.ClearContents The name "AccountAbbreviations" is, in fact,notdefined. How can I check fornotdefined so that the code can continue? TIA, Phil- Hide quoted text - - Show quoted text - thanks Chip. |
All times are GMT +1. The time now is 07:38 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com