+ Reply to Thread
Results 1 to 11 of 11

Active Workbook issue

Hybrid View

  1. #1
    Registered User
    Join Date
    09-17-2010
    Location
    Allen, TX
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: Active Workbook issue

    Correct, row 2 is my header. Your code works just like I want on my test file, however, when I run it on my larger worksheet (over 4700 lines), the header is sorted into my data, and the sort on column H doesn't appear to work.

  2. #2
    Registered User
    Join Date
    09-17-2010
    Location
    Allen, TX
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: Active Workbook issue

    This is a more accurate example of what I'm working with, but on a much larger scale. When I run your macro on this, the header gets sorted along with the data.
    Attached Files Attached Files

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

    Re: Active Workbook issue

    Sub SortIt()
        Dim wks         As Worksheet
    
        Set wks = ActiveSheet
    
        With wks
            .UsedRange.Offset(1).Sort _
                    Key1:=.Range("J2"), Order1:=xlAscending, _
                    Key1:=.Range("H2"), Order2:=xlAscending, _
                    Header:=xlYes, _
                    MatchCase:=False, _
                    Orientation:=xlTopToBottom
        End With
    End Sub
    Entia non sunt multiplicanda sine necessitate

+ 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