+ Reply to Thread
Results 1 to 4 of 4

Macro to sort current tab worksheet i'm on by V U T

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    01-25-2009
    Location
    Louisiana
    MS-Off Ver
    Excel 2007
    Posts
    177

    Macro to sort current tab worksheet i'm on by V U T

    I have this workbook with many tabs simliar to the example i provided.

    I basically need a macro to sort the sheet by V, U, T starting from row 3 and ending before the last vechicle. This is the problem though, the last vehicle ends everytime right before Car # in column A. So in other words in this example i would need it sorted by v u t, starting from 3 down to row 12. It ends at 12 because the next line includes car and a number.

    Another sheet might have a longer list of vehicles and might end at row 100 before the next line has car number .


    It always starts at 3, but the ending is dynamic where it should stop its selection before "car number ".

    I would also like it to work on the current sheet im on, because i have up to 100 sheets like this and would not want it name dependant. Just want to click on a tab, and run a macro and have it sort from 3 down to the line before car in column A.

    Another thing i should mention in this example i pasted values, in my real workbook it will contain links, so i everything including Column A which lists the vehicles and year spans will be displayed through a link from another workbook.

    In the included file i have what i start off with and end up with to clear any confusion.

    Main thing is to have it stop its selection from row 3 down till it runs into a name of Car Number in column A where it stops before that line. Then have it sort by V, U, T. Keeping in mind most of the values in the cells are linked from another workbook.

    Thanks for anyone that helps,
    Attached Files Attached Files
    Last edited by donnydorko; 03-26-2009 at 05:09 PM.

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

    Re: Macro to sort current tab worksheet i'm on by V U T

    Hi

    See how this goes.

    Sub aaa()
      Set findit = Range("A:A").Find(what:="Car")
      Range("A2:AJ" & findit.Row - 1).Sort key1:=Range("V2"), order1:=xlAscending, key2:=Range("U2"), order2:=xlAscending, key3:=Range("T2"), order3:=xlAscending, header:=xlYes
      
    End Sub
    rylo

  3. #3
    Forum Contributor
    Join Date
    01-25-2009
    Location
    Louisiana
    MS-Off Ver
    Excel 2007
    Posts
    177

    Re: Macro to sort current tab worksheet i'm on by V U T

    rylo it works perfectly as long as the cell is not pulling from a link,

    in otherwords if i change the value in my real sheet where car 101 is located to car 101 instead of it referencing a link which has the value of car 101 it works, otherwise it doesnt. Can it work to where it looks for the value in the cell? instead of the link? or formula? just the results.

    ='C:\Desktop\TOW\[03-01-09 TOW ~Tier1.xls]15K T1 Package'!$ET$1

    see thats whats in the cell of car 101 ( what i have above is what is in the cell where car 101 is), its a link.

    Thanks
    Last edited by donnydorko; 03-26-2009 at 03:18 AM.

  4. #4
    Forum Contributor
    Join Date
    01-25-2009
    Location
    Louisiana
    MS-Off Ver
    Excel 2007
    Posts
    177

    Re: Macro to sort current tab worksheet i'm on by V U T

    anyone? :o

+ 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