Run-time error on previously good macro

User avatar
sobershea
2StarLounger
Posts: 184
Joined: 08 Feb 2010, 23:37
Location: Howell, Michigan USA

Run-time error on previously good macro

Post by sobershea »

I have a macro that has worked fine for quite a while but this month it failed with a Run-time error '1004': Method 'Range' of object '_Global' failed. The particular piece of code that fails is

Code: Select all

Range("ddate") = Application.InputBox(prompt:= _
             "Enter 2-digit numeric value of the month.", _
                Title:="Specify Month")
I thought the named range 'ddate' had somehow been deleted but it is still there. Any ideas what the error is telling me?
Sherry

User avatar
HansV
Administrator
Posts: 78492
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Run-time error on previously good macro

Post by HansV »

The error message does mean that the code can't find the range named ddate.
Are you sure the named range is named exactly ddate?
If so, what is its definition?
Best wishes,
Hans

User avatar
sobershea
2StarLounger
Posts: 184
Joined: 08 Feb 2010, 23:37
Location: Howell, Michigan USA

Re: Run-time error on previously good macro

Post by sobershea »

Got it! As soon as you said it was definitely the range name I started checking and because of a blip last month there were two ranges named ddate. I deleted one and tried running the macro and it still failed. So I deleted the second one, saved the file, added the range name back in, saved, and ran the macro. And all is well. Thanks much.
:thankyou:
Sherry