+ Reply to Thread
Results 1 to 21 of 21

sort and then insert rows help!

Hybrid View

  1. #1
    RompStar
    Guest

    Re: sort and then insert rows help!

    yep, yep, I was just waiting for you to help me, lol

    I have learnd so much from you already :- ) taking advantage of a
    education
    reimbursement program here at work, so I started to go to college for
    database administration, hopefully I will learn a lot more in the next
    3-4 years :- )

    Thanks a lot!


  2. #2
    RompStar
    Guest

    Re: sort and then insert rows help!

    I'll test it on monday and tell you if there is anything weird going
    on, I'll step into it and follow it line by line to
    learn new things, thanks.


  3. #3
    Dave Peterson
    Guest

    Re: sort and then insert rows help!

    It's a nice benefit. Take advantage of it while it's still there.

    RompStar wrote:
    >
    > yep, yep, I was just waiting for you to help me, lol
    >
    > I have learnd so much from you already :- ) taking advantage of a
    > education
    > reimbursement program here at work, so I started to go to college for
    > database administration, hopefully I will learn a lot more in the next
    > 3-4 years :- )
    >
    > Thanks a lot!


    --

    Dave Peterson

  4. #4
    RompStar
    Guest

    Re: sort and then insert rows help!

    so I commented out the insert row part of the vb code and only wanted
    to see if the sorting works,
    it sorts, but not correctly, it sorts the same name maybe 5 rows and
    then it goes to the next,
    and then it eventually starts to sort the same name again, it doens't
    sort them all
    in one shot and then go to the next, the sort is kinda broken apart
    sort, not even all the way through ?

    any ideas why ?


  5. #5
    Dave Peterson
    Guest

    Re: sort and then insert rows help!

    Record a macro when you sort by both keys.

    Then modify this portion:

    .Columns("A:F").Sort _
    Key1:=.Range("A1"), Order1:=xlAscending, _
    Key2:=.Range("B1"), Order2:=xlAscending, _
    Header:=xlNo, OrderCustom:=1, MatchCase:=False, _
    Orientation:=xlTopToBottom, DataOption1:=xlSortNormal

    Maybe it's just swapping key1 and key2?????

    RompStar wrote:
    >
    > so I commented out the insert row part of the vb code and only wanted
    > to see if the sorting works,
    > it sorts, but not correctly, it sorts the same name maybe 5 rows and
    > then it goes to the next,
    > and then it eventually starts to sort the same name again, it doens't
    > sort them all
    > in one shot and then go to the next, the sort is kinda broken apart
    > sort, not even all the way through ?
    >
    > any ideas why ?


    --

    Dave Peterson

  6. #6
    RompStar
    Guest

    Re: sort and then insert rows help!

    Macro 2 works, Macro 3 don't work, I noticed that when I sort by Column
    A and then I repeat the sort process by column B, it works,
    but if I try to sort A and B at the same time, it don't.



    Sub Macro2()
    '
    ' Macro2 Macro
    '

    '
    Columns("A:F").Select
    Range("F1").Activate
    Selection.Sort Key1:=Range("A1"), Order1:=xlAscending,
    Header:=xlGuess, _
    OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
    DataOption1:=xlSortNormal


    Selection.Sort Key1:=Range("B1"), Order1:=xlAscending,
    Header:=xlGuess, _
    OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
    DataOption1:=xlSortNormal
    End Sub
    Sub Macro3()
    '
    ' Macro3 Macro

    '
    Columns("A:F").Select
    Range("F1").Activate
    Selection.Sort Key1:=Range("A1"), Order1:=xlAscending,
    Key2:=Range("B1") _
    , Order2:=xlAscending, Header:=xlNo, OrderCustom:=1,
    MatchCase:=False, _
    Orientation:=xlTopToBottom, DataOption1:=xlSortNormal,
    DataOption2:= _
    xlSortNormal
    Range("E25").Select
    End Sub


  7. #7
    Dave Peterson
    Guest

    Re: sort and then insert rows help!

    I meant try this:

    .Columns("A:F").Sort _
    Key1:=.Range("B1"), Order1:=xlAscending, _
    Key2:=.Range("A1"), Order2:=xlAscending, _
    Header:=xlNo, OrderCustom:=1, MatchCase:=False, _
    Orientation:=xlTopToBottom, DataOption1:=xlSortNormal

    So Column B becomes the primary sort and column A is the secondary sort.



    RompStar wrote:
    >
    > Macro 2 works, Macro 3 don't work, I noticed that when I sort by Column
    > A and then I repeat the sort process by column B, it works,
    > but if I try to sort A and B at the same time, it don't.
    >
    > Sub Macro2()
    > '
    > ' Macro2 Macro
    > '
    >
    > '
    > Columns("A:F").Select
    > Range("F1").Activate
    > Selection.Sort Key1:=Range("A1"), Order1:=xlAscending,
    > Header:=xlGuess, _
    > OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
    > DataOption1:=xlSortNormal
    >
    > Selection.Sort Key1:=Range("B1"), Order1:=xlAscending,
    > Header:=xlGuess, _
    > OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
    > DataOption1:=xlSortNormal
    > End Sub
    > Sub Macro3()
    > '
    > ' Macro3 Macro
    >
    > '
    > Columns("A:F").Select
    > Range("F1").Activate
    > Selection.Sort Key1:=Range("A1"), Order1:=xlAscending,
    > Key2:=Range("B1") _
    > , Order2:=xlAscending, Header:=xlNo, OrderCustom:=1,
    > MatchCase:=False, _
    > Orientation:=xlTopToBottom, DataOption1:=xlSortNormal,
    > DataOption2:= _
    > xlSortNormal
    > Range("E25").Select
    > End Sub


    --

    Dave Peterson

  8. #8
    RompStar
    Guest

    Re: sort and then insert rows help!

    ohhhh :-) let me try that...


+ 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