+ Reply to Thread
Results 1 to 4 of 4

run time error 1004

  1. #1
    Registered User
    Join Date
    11-09-2011
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    9

    run time error 1004

    Hi,
    i get this error message when i run the macro below. The macro will run for about 20 times but then this message will come up

    Run-time error '1004';
    To prevent possible losss of data, Excel cannot shift nonblank cells off of the worksheet. Select another location in which to insert new cells, or delete data from the end of you worksheet.
    If you do not have data in cells that can be shifted off of the worksheet, you can reset which cells Excel considers nonblank. To do this, press CTRL + End to locate the last nonblank cell

    Here is the macro
    Please Login or Register  to view this content.
    And the yellow text is what was highlighted when i went to 'DEBUG'

    Any help would be greatly appreciated from someone more knowledgable..
    Many thanks
    lburch
    Last edited by Leith Ross; 01-03-2012 at 12:47 AM. Reason: Added Code Tags

  2. #2
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: run time error 1004

    Hi lburch,

    It's little wonder you're encountering this error. Each time your macro runs, it tries to shift the existing data on BA 11 columns to the right. Eventually, it's going to run out of columns the data can be moved to.

    FWIW, your code could be made much more efficient:
    Please Login or Register  to view this content.
    It'll still run out of columns, though, so you need to address that as the underlying issue.
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    Registered User
    Join Date
    11-09-2011
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: run time error 1004

    Hi paul,
    no the macro will only ever run 100 times before another macro inserts 69 more rows so i wont run out of room to the right.....and the code is just what it looks like after manually recording. i dont know enough VBA to write code myself...
    i hope you have another view to what it is.....
    is there a chance that 'office' is saying there s that much data that you have to save before you can insrt more cells...and if that is it how can i put a 'save file' command into a macro.
    cheers
    lburch

  4. #4
    Registered User
    Join Date
    11-09-2011
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: run time error 1004

    Hi paul,
    no the macro will only ever run 100 times before another macro inserts 69 more rows so i wont run out of room to the right.....and the code is just what it looks like after manually recording. i dont know enough VBA to write code myself...
    i hope you have another view to what it is.....
    is there a chance that 'office' is saying there s that much data that you have to save before you can insrt more cells...and if that is it how can i put a 'save file' command into a macro.
    cheers
    lburch

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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