+ Reply to Thread
Results 1 to 10 of 10

Sorting problem 2003 vs 2007

  1. #1
    Registered User
    Join Date
    06-07-2010
    Location
    Blantyre, Malawi
    MS-Off Ver
    Excel 2003
    Posts
    20

    Question Sorting problem 2003 vs 2007

    Hi All,

    The code below works fine on a machine running Excel 2003 but when transferred to a machine running Vista with Excel 2007 I get a “Run time Error 1004”

    Is there a way to have the same code run on both versions?

    PS I have deliberately done all my development in 2003 believing that it would all work on 2007 but that it would not work the other way around. Am I correct?

    Regards,

    Alan


    Please Login or Register  to view this content.
    Last edited by AlanAnderson; 07-20-2010 at 05:49 AM.

  2. #2
    Forum Contributor
    Join Date
    05-09-2009
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    315

    Re: Sorting problem 2003 vs 2007

    Your code works fine for me in 2007. My guess is it's something outside of the code you've provided which is causing the problem.

    Can you upload the workbook?

    Dion

  3. #3
    Registered User
    Join Date
    06-07-2010
    Location
    Blantyre, Malawi
    MS-Off Ver
    Excel 2003
    Posts
    20

    Question Re: Sorting problem 2003 vs 2007

    Hi Dion,

    Thanks for the help.

    I think you are right. It is probably not feasible to upload the entire workbook as it is really big.

    What I have noticed is that 2007 is creating a fancy table with headers containing sorting facilities etc. This does not occur in 2003. Seeing as the error message refers to a sort problem is this not the issue?

    What can I put in the code to either "switch off" this facility in 2007 or to make the 2003 sort "acceptable" to the new type of table?

    Thanks again,

    Alan

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,978

    Re: Sorting problem 2003 vs 2007

    What exactly is this range you are sorting? An external query?
    Have you tried including row 1 in the sort and specifying that you have headers?
    Everyone who confuses correlation and causation ends up dead.

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Sorting problem 2003 vs 2007

    Try using the macro Recorder whilst sorting, then post the code for help modifying it
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  6. #6
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,978

    Re: Sorting problem 2003 vs 2007

    FWIW, I just tested your code on a simple table in 2007 and it worked fine, so maybe a sample of the actual failing workbook would be useful.

  7. #7
    Registered User
    Join Date
    06-07-2010
    Location
    Blantyre, Malawi
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: Sorting problem 2003 vs 2007

    Hi,
    I am in the process of extracting the offending modules and sheets from the programme.

    Will get back later

  8. #8
    Registered User
    Join Date
    06-07-2010
    Location
    Blantyre, Malawi
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: Sorting problem 2003 vs 2007

    Hi Again,
    I am enclosing the module that contains the "offending" code.
    I am also enclosing 4 xls files.
    Whilst being a total newbiw I am convinced the problem lies in these. . Where the import file and export files are both handled in Excel 2003 the info resides in a straight forward data format..
    When these files are taken to a 2007 machine a table is created with facilities for sorting etc which does not happen in 2003.
    btw the format of some of the columns also changes (num,bers to dates etc) but this may just be a bug I have not looked into yet.

    What really bugs me is that this code works perfectly in 2003 - its just when copied to 2007 it falls over.

    Please help - I really am lost.

    Regards,

    Alan.

    PS the entire programme is very large.and cant be uploaded.

    This code opens the file and imports it into my data file to a page called PasConv

    Please Login or Register  to view this content.
    After the above code is all run then following routine sorts and then puts data ito various pages. The web page will not allow the entire routine as its too large so I have cut it off just after the problem occurs.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    06-07-2010
    Location
    Blantyre, Malawi
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: Sorting problem 2003 vs 2007

    Sorry,
    Having real problems uploading files.
    If I could just describe the data files.
    They are simple - just 10columns containining data. 3 columns containing data obtained by simple arithmetic calculations based on other columns.

    All columns have headers.
    WWhere the files are in 2007 those headers get changed to "smart headers" - ie you can click on headers to sort data. This is not the case in 2003.

    When I try to use VBA generated in 2003 to sort these "converted files" it falls over.

    Regards,

    Alan
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    06-07-2010
    Location
    Blantyre, Malawi
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: Sorting problem 2003 vs 2007

    Hi,
    Problem solved. I had to write routine that did different sort depending on version.

    Thanks,

    Alan

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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