+ Reply to Thread
Results 1 to 3 of 3

Run-time error 1004, application-defined or object-defined error

  1. #1
    Registered User
    Join Date
    04-09-2008
    Posts
    1

    Run-time error 1004, application-defined or object-defined error

    Hello everybody,

    I have a problem when i run my macro it says "runtime-error.." as in the title.. really dont know what is wrong? the macro is done with relative cell reference.

    the problem is in following code line:

    "ActiveCell.Offset(-81, 0).Range("A1").Activate"



    And here is the entire code:
    Please Login or Register  to view this content.
    Does anybody now how to solve this??

    What i want to do is range some numbers in one column, but i want another column to "follow" this ranging as the ID of the numbers is in this column. And i want to be able to do it on a vast number of columns, so thats why i recorded a macro to save time.. hope it makes sense

    Martin
    Last edited by Leith Ross; 04-10-2008 at 02:26 AM.

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,612
    Hi Martin,
    First, try to clean up the code from the macro_recorder by deleting or commenting (put a single quote ' at the start of the line) out all lines such as:

    ActiveWindow.SmallScroll Down:=-78
    Next, go directly to a cell or range of cells using code such as:
    Please Login or Register  to view this content.
    instead of: ActiveCell.Offset(-81, -11).Range("A1:L80").Select
    As it is, the above line will run or error out depending on where the selected cell happens to be at the time the code is run. For instance ...Offset(-81,-11)... will try to go UP 81 rows from the current cell and left 11 columns. If you are 81 or fewer rows down from Row 1 or less than 12 columns from Col A, then you will get an error (i.e., you're pointing off the sheet)

    If you repost, please wrap your code by clicking the "#" on the upper toolbar and pasting your code between the "[code ][/code ]" tags.
    Ben Van Johnson

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello DonNewcastle,

    Welcome to the Forum!

    To make your posts easier to read and preserve your formatting, please wrap your code. I did it for you this time. Here is how you can do it next time.

    How to wrap your Code
    On the Message window Toolbar you will see the # icon. This will automatically wrap the text you selected with the proper HTML tags to create a Code Window in your post. You can do this manually by placing the tag [code]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/code] at the end.

    As a new member please take so time to familiarize yourself with the Do's and Don'ts here in the Forum, just click on the link below...

    Forum Rules

    Sincerely,
    Leith Ross

+ 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