+ Reply to Thread
Results 1 to 13 of 13

VB data sorting macro unable to sort correctly

  1. #1
    Registered User
    Join Date
    07-05-2009
    Location
    Brisbane
    MS-Off Ver
    Excel 2007
    Posts
    61

    VB data sorting macro unable to sort correctly

    Hey everyone,

    I am putting together multiple worksheets with dumped data that should sort themselves by the press of a button. Each entry has a 'code' and a value and they are sorted by the 'code'.

    At the moment i have the first worksheet sorting correctly and i am trying to program the second worksheet to sort data into the existing worksheets if they exist or create a new worksheet if the data doesn't have it's own worksheet.

    Here is the code i am working with.

    Please Login or Register  to view this content.
    I'm a complete noob and i am working with re-engineered code that i don't completely understand (that was supplied from this forum ). Any help to sort this this mess out would be greatly appreciated.

    Here is a sample copy of the Excel file.
    Attached Files Attached Files
    Last edited by Ace of Clubs; 07-13-2009 at 01:45 AM.

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: VB data sorting macro unable to sort correctly

    Hi

    I don't have 2007 and am using a converter. Can you please turn of the JIT debugging, or convert to a 2003 format for your example file.

    To clarify, you just want to break out the data from sheet commitments to separate sheets, based on the value in column I. If the sheet exists, then append the data. If it doesn't exist, then create the sheet, then append the data.

    rylo

  3. #3
    Registered User
    Join Date
    07-05-2009
    Location
    Brisbane
    MS-Off Ver
    Excel 2007
    Posts
    61

    Re: VB data sorting macro unable to sort correctly

    Hey,

    Here is a 2003 format version.

    Also i am using VBE so i don't think JIT debugging is enabled?

    Thank you
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: VB data sorting macro unable to sort correctly

    Hi

    Exactly which sheet are you trying to burst out? Actuals or Commitments?

    Looking at the example, the output sheets seem to match the Actuals structure, but your post says you are trying to use Commitments.

    Which sheet is it? And do you want to remove any existing data on the output sheets before bursting out?


    rylo

  5. #5
    Registered User
    Join Date
    07-05-2009
    Location
    Brisbane
    MS-Off Ver
    Excel 2007
    Posts
    61

    Re: VB data sorting macro unable to sort correctly

    Quote Originally Posted by rylo View Post
    Hi

    Exactly which sheet are you trying to burst out? Actuals or Commitments?

    Looking at the example, the output sheets seem to match the Actuals structure, but your post says you are trying to use Commitments.

    Which sheet is it? And do you want to remove any existing data on the output sheets before bursting out?


    rylo
    Hey,

    I would like to generate Actuals and then append sorted commitments under Actuals if the worksheet already exists or create a new worksheet if it doesn't.

    The code that deletes all the worksheets in commitments is for testing purposes and can be removed.

    Thanks

  6. #6
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: VB data sorting macro unable to sort correctly

    so what items from commitments are to be moved to any existing sheet, and where do they go?

    rylo

  7. #7
    Registered User
    Join Date
    07-05-2009
    Location
    Brisbane
    MS-Off Ver
    Excel 2007
    Posts
    61

    Re: VB data sorting macro unable to sort correctly

    Quote Originally Posted by rylo View Post
    so what items from commitments are to be moved to any existing sheet, and where do they go?

    rylo

    Each item in commitments has a 'code'.
    Those coded commitment items need to be sorted into their corresponding worksheet just above Actuals data in its own table.
    If no worksheet for that code exists excel should create one and insert the data.

    Hope that makes sense.

  8. #8
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: VB data sorting macro unable to sort correctly

    Hi

    Using your example, the code 2200 has a sheet and an item in the commitments sheet. There are 2 values for this code: Date (E3) and Committed value (B3).

    Which of these values goes across to the sheet 2200, and exactly where does it go? Give an input and output cell reference, as the heading in the commitment sheet don't match the headings in the 2200 sheet.

    rylo

  9. #9
    Registered User
    Join Date
    07-05-2009
    Location
    Brisbane
    MS-Off Ver
    Excel 2007
    Posts
    61

    Re: VB data sorting macro unable to sort correctly

    Quote Originally Posted by rylo View Post
    Hi

    Using your example, the code 2200 has a sheet and an item in the commitments sheet. There are 2 values for this code: Date (E3) and Committed value (B3).

    Which of these values goes across to the sheet 2200, and exactly where does it go? Give an input and output cell reference, as the heading in the commitment sheet don't match the headings in the 2200 sheet.

    rylo
    The entire commitments table with the corresponding code needs to be copied over just below the actuals table.

    Each Code sheet should have an actuals and commitments table. Even If there are no values for either actuals or commitments.

  10. #10
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: VB data sorting macro unable to sort correctly

    Ace, please don't quote whole posts -- it just clutters the forum.
    Entia non sunt multiplicanda sine necessitate

  11. #11
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: VB data sorting macro unable to sort correctly

    Hi

    Put this in the commitments sheet code area.

    Please Login or Register  to view this content.
    Does that give you what you are trying to achieve?

    rylo

  12. #12
    Registered User
    Join Date
    07-05-2009
    Location
    Brisbane
    MS-Off Ver
    Excel 2007
    Posts
    61

    Re: VB data sorting macro unable to sort correctly

    Sorry shg.

    Yes thank you, that is perfect rylo

    + rep

  13. #13
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: VB data sorting macro unable to sort correctly

    Hi

    Great. Can you go back to the original post, and mark as SOLVED.

    thanks

    rylo

+ 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