+ Reply to Thread
Results 1 to 5 of 5

Sorting into multiple sheets

  1. #1
    Registered User
    Join Date
    09-14-2007
    Posts
    8

    Sorting into multiple sheets

    I've tried googling this, but i'm only finding issues the wrong way. Maybe i'm google after the wrong thing..

    I have each month a set of data, i would like to have sorted/cut n paste to several sheets.

    I made a very simple test sheet. for it. in this example you can see what i need to do..

    I put in data in data sheet. I then run macro that will sort and move intire lines after there department. always copied after last value. Sorted after dateAttachment 133308
    on purpose there are 2 simular lines. while this can be a possebillity.

    This example will then create 3 lines in "T 1" and 1 in both "T 2" and "T 3".

    Departments and sheets, will increase in time. So a intelligent way to do this instead of hardcoding after each incline in departments is appreciated. I'm think that i can make some kind of look up list of 200 rows. And it will run through and only look for the set range of values. also so this can be used for other purposes.

    Hope someone can tell me, what to look for out there, I've tried some kind of a loop with ifs and offset. But that was a terrible setup.. or maybe someone can create this macro in a second.


    Also is there som good online tutorials on the setting up applications/loops in vba.. I'm selvtaught from google, and a lot of intrest. And i'm getting better all the time.. I can understand things like

    Sub CopyByPage()
    Dim rRange As Range, rCell As Range, Helper As Range
    Dim wSheet As Worksheet
    Dim wsMaster As Worksheet
    Dim strText As String

    With Application
    But only if i get them online. I not good enough to compile theese. and would love to learn.. Because this works better than all the loops I end up making. :-)

    In advance Thank you very much..
    Attached Files Attached Files

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

    Re: Sorting into multiple sheets

    Hello Seisbye,

    The following macro has been added to the attached workbook. There is button on the "Data" sheet to run the macro. I had to rename the sheets "T 1", "T 2", "T 3" to "T1", "T2", "T3". You entered them on the "Data" sheet as "T1", "T2", and "T3".
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    09-14-2007
    Posts
    8

    Re: Sorting into multiple sheets

    That just looks PERFECT!! Thank you very much..

    I will test it asap.

    If i read it correct, then it will look up the name of all the existing sheets correct? So i just add til unlimited?

    Also if i'm reading correct, then if the data where to start on row 20. i just correct SrcWks.Range("A4") to "A20" correct? And if the comparrison/department is further away in the coloums i just correct the offset?

    Do you have a good link to where i can learn to setup applications like this? I've only learned to do dim x as interger and then setup up objects. But i would love to learn, both all the possibillities. Here you use Variant, long, string etc. And also how to build it up prober.

    any good links on this?

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

    Re: Sorting into multiple sheets

    Hello Seisbye,

    Sorry for the late reply. My computer has been crashing intermittently and I have been attempt to isolate the cause.
    Also if i'm reading correct, then if the data where to start on row 20. i just correct SrcWks.Range("A4") to "A20" correct?
    If you change the starting row to 20 then you would also need to change another line of code. See below...
    Please Login or Register  to view this content.
    And if the comparrison/department is further away in the coloums i just correct the offset?
    You're correct. The offset in the line below is measured from column "A".
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    09-14-2007
    Posts
    8

    Re: Sorting into multiple sheets

    After some testing i can say it just works PERFECT!! Thank you very much

    How do i set thread as solved, when i can't edit my first post?
    Last edited by Seisbye; 02-08-2012 at 08:18 AM.

+ 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