+ Reply to Thread
Results 1 to 4 of 4

Sort 1004 error

  1. #1
    Registered User
    Join Date
    06-29-2010
    Location
    Mississauga
    MS-Off Ver
    Excel 2007
    Posts
    19

    Sort 1004 error

    I used this exact code on one of my spreadsheets and it worked great, I had a previous thread about this.

    Please Login or Register  to view this content.
    Now, I've moved this code to another spreadsheet, changed the ranges, and I'm getting a runtime error 1004, sort reference is not valid, make sure its within the data you want to sort etc...

    Please Login or Register  to view this content.
    L10 falls inside the range, and L10 has data, as does the rest of the column below it.

  2. #2
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: Sort 1004 error

    Your second line seems to have a sytax error at the end; there is a , _ instead of a open parenthese.
    Is your code running too slowly?
    Does your workbook or database have a bunch of duplicate pieces of data?
    Have a look at this article to learn the best ways to set up your projects.
    It will save both time and effort in the long run!


    Dave

  3. #3
    Registered User
    Join Date
    06-29-2010
    Location
    Mississauga
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Sort 1004 error

    Quote Originally Posted by davegugg View Post
    Your second line seems to have a sytax error at the end; there is a , _ instead of a open parenthese.
    Yeah, just something in the way it pasted.

    The yellow highlighted area in the VBA editor says this is the problem :

    Please Login or Register  to view this content.

  4. #4
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: Sort 1004 error

    I believe the error is saying cell L10 is not in your sort range. When the error occurs, check your sort range in the immediate window by typing:

    Please Login or Register  to view this content.
    Make sure L10 is somewhere in there.

+ 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