+ Reply to Thread
Results 1 to 7 of 7

Run-time error 1004

  1. #1
    Registered User
    Join Date
    10-26-2007
    Posts
    5

    Run-time error 1004

    Hi, i have the following code behind a worksheet :-

    Set oSheet = Me
    oSheet.UsedRange.Offset(3, 0).EntireRow.Delete

    But the line "oSheet.UsedRange.Offset(3, 0).EntireRow.Delete" is generating "Run-time error '1004';". Can anyone tell me what i'm doing wrong please ?, thanks for your time.

  2. #2
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983

    Re: Run-time error 1004

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  3. #3
    Registered User
    Join Date
    10-26-2007
    Posts
    5

    Re: Run-time error 1004

    Apologies - forgot to mark my code, VBA is as below ...

    Please Login or Register  to view this content.

  4. #4
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983

    Re: Run-time error 1004

    Not sure what you are trying to do

    The code works for me as long as it is placed on a worksheet module

    e.g
    if sheet has entries in rows 1 to 20
    It deletes rows 4 to 23 - Which is the number of rows equal to the number of rows with data offset by 3 rows

  5. #5
    Registered User
    Join Date
    10-26-2007
    Posts
    5

    Re: Run-time error 1004

    Hi, that is what i'm trying to do. The first 3 rows contain fixed header information i wish to keep, but i want to delete the contents of all the other rows in the sheet.

    Code is in a Module, i'm using Excel 2003 - is there another way to do this ? ... thanks for your input.

  6. #6
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Run-time error 1004

    Hi, Your code also worked for me, but this is an alternative.
    Please Login or Register  to view this content.
    Regards Mick

  7. #7
    Registered User
    Join Date
    10-26-2007
    Posts
    5

    Re: Run-time error 1004

    Thanks Mick - that works a treat with no errors - i'm up and running !

+ 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