+ Reply to Thread
Results 1 to 3 of 3

Application Defined or Object Defined Error Run time error 1004

  1. #1
    Registered User
    Join Date
    10-21-2021
    Location
    New Delhi
    MS-Off Ver
    MS Office 2016
    Posts
    6

    Application Defined or Object Defined Error Run time error 1004

    Please Login or Register  to view this content.
    Last edited by Paul; 03-30-2022 at 02:00 PM.

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885

    Re: Application Defined or Object Defined Error Run time error 1004

    Possibly because in VBA, year is a VBA function to extract the year from a date. I'm pretty sure you can't name a variable the same as a function name.

  3. #3
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,206

    Re: Application Defined or Object Defined Error Run time error 1004

    Paul, you can name a variable with the same name as a function, but you should absolutely avoid such situations. If the variable is not declared, the compiler interprets it as a function, which may result in an error, as in this case. Compare the operation of the three procedures. It is assumed that there is no Option Explicit directive at the beginning of the module.
    Please Login or Register  to view this content.
    Artik
    Last edited by Artik; 03-30-2022 at 06:13 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Error message: Run-Time error '1004 '; application-defined or object-defined error
    By Davasu in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-23-2015, 06:52 AM
  2. Replies: 1
    Last Post: 10-22-2015, 05:50 AM
  3. VBA ERROR: run time error 1004: Application-defined or Object-defined error in excel 2013
    By AnanthKrishna in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-13-2015, 06:16 AM
  4. excel macro run time error '1004'- Application defined or object defined error
    By kmadan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-16-2014, 09:51 AM
  5. Replies: 1
    Last Post: 03-12-2014, 12:42 PM
  6. [SOLVED] Run time error 1004 Application-Defined or Object-Defined Error - Placing data into next e
    By michelle 1 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 01-27-2014, 12:57 PM
  7. [SOLVED] run-time error '1004' application-defined or object-defined error - Excel 2007
    By kaurka in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-06-2012, 02:46 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1