+ Reply to Thread
Results 1 to 4 of 4

Run-time error 1004 Application-defined or object-defined error

  1. #1
    Forum Contributor
    Join Date
    09-10-2016
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    680

    Run-time error 1004 Application-defined or object-defined error

    Please Login or Register  to view this content.
    The button is in sheet Dashboard, when I click the button and it returns the error.

    What does it mean and how to fix it?

    Thanks.

  2. #2
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,418

    Re: Run-time error 1004 Application-defined or object-defined error

    https://stackoverflow.com/questions/...1%20characters.

    apparently, there could be a cell with a very long string in it ???
    What happens if you do it in 2 steps?
    Please Login or Register  to view this content.
    Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Run-time error 1004 Application-defined or object-defined error

    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,224

    Re: Run-time error 1004 Application-defined or object-defined error

    You can reference a Range object in several ways. One is referencing starting and ending cells by reference. Your Range object is a certain range in the Temp worksheet. Since the Dashboard sheet is active at this point, using the code
    Please Login or Register  to view this content.
    it tried to create a Range object on the Temp sheet, but from cells in the Dashboard sheet (or active sheet). This is obviously impossible, and that's why you were getting an error. The actual range reference would be the code:
    Please Login or Register  to view this content.
    , but it is very long and inconvenient. Therefore, the construction With ... End With is used, as jindon has shown. Note the dots in front of Cells, they will make the range's start and end cells reference the Temp sheet.
    Another way to refer to Range is by addressing. The following code will be correct, even though Cells points to cells in the active worksheet. But we only get the address.
    Please Login or Register  to view this content.
    Since the start and end cells are constant, it will be more readable to use addresses this way:
    Please Login or Register  to view this content.
    Artik

+ 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. 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
  3. 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
  4. Replies: 1
    Last Post: 03-12-2014, 12:42 PM
  5. [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
  6. [SOLVED] Error " Run-time error '1004': application defined or object defined error
    By lengwer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-11-2013, 07:26 AM
  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

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