Results 1 to 3 of 3

Thread: Issue with sort code

  1. #1
    Board Regular
    Join Date
    Nov 2010
    Posts
    2,478
    Post Thanks / Like
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)

    Default Issue with sort code

    Morning,
    I have the sort code as supplied below.
    Some info for you.

    I have headers in cell range A6:H6
    Row 7 has the first line of values then continue down the page.
    The range of values are A7:H40

    Example.
    Cell H7 value CC
    Cell H8 value AA
    Cell H9 value BB

    When i run the sort code it stays the same as opposed to sorting AA BB CC






    Code:
    Private Sub SortYearButton_Click()    Dim x As Long
        
        Application.ScreenUpdating = False
        
        With Sheets("MC LIST")
            If .AutoFilterMode Then .AutoFilterMode = False
            x = .Cells(.Rows.Count, 1).End(xlUp).Row
            
            .Range("A7:H" & x).Sort key1:=Range("H7"), order1:=xlAscending, Header:=xlGuess
            
        End With
                          
        ActiveWorkbook.Save
        
        Application.ScreenUpdating = True
        Sheets("MC LIST").Range("H7").Select
    End Sub
    I have learning difficulties so please be patient if i'm slow on the uptake,Thanks Very Much...

  2. #2
    Board Regular
    Join Date
    Sep 2016
    Posts
    2,582
    Post Thanks / Like
    Mentioned
    36 Post(s)
    Tagged
    1 Thread(s)

    Default Re: Issue with sort code

    Header:=xlNo

  3. #3
    Board Regular
    Join Date
    Nov 2010
    Posts
    2,478
    Post Thanks / Like
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Issue with sort code

    Many thanks.

    I didnt spot that & now changed
    I have learning difficulties so please be patient if i'm slow on the uptake,Thanks Very Much...

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •