Sort Alphabetic and Automatically Update When Added Data

Likes Likes:  0
Results 1 to 3 of 3

Thread: Sort Alphabetic and Automatically Update When Added Data

  1. #1
    Board Regular muhammad susanto's Avatar
    Join Date
    Jan 2013
    Location
    KPKNL Pekanbaru, Riau
    Posts
    1,304
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Sort Alphabetic and Automatically Update When Added Data

     
    hi all....

    how to automatically sort and update asc to desc (alphabetic)
    this layout :

    data expected result
    zzz b
    zzz dddddd
    b dddddd
    dddddd dddddd
    dddddd dddddd
    dddddd s
    dddddd s
    s s
    s zzz
    s zzz


    thanks

    m.susanto
    Last edited by muhammad susanto; Dec 7th, 2017 at 08:42 PM.
    Sembunyikan & rahasiakan amal kebaikan kita sebagaimana kita mahir dalam menyembunyikan aib-aib kita

    Play in Ms Excel 2007 & 2013 on Win 7 32 Bit

  2. #2
    MrExcel MVP
    Join Date
    May 2009
    Posts
    14,758
    Post Thanks / Like
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Sort Alphabetic and Automatically Update When Added Data

    Assuming your data are in col A starting in A2, put this in the sheet's code:

    To install sheet code:
    1. Right-click the worksheet tab you want to apply it to and choose 'View Code'. This will open the VBE window.
    2. Copy the code below from your browser window and paste it into the white space in the VBE window.
    3. Close the VBE window and Save the workbook. If you are using Excel 2007 or a later version do a SaveAs and save it as a macro-enabled workbook (.xlsm file extension).
    4. Make sure you have enabled macros whenever you open the file or the code will not run.
    Code:
    Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Range("A2:A" & Cells(Rows.Count, "A").End(xlUp).Row)) Is Nothing Then
        Application.EnableEvents = False
        Range("A2:A" & Cells(Rows.Count, "A").End(xlUp).Row).Sort key1:=[A2], order1:=xlAscending
        Application.EnableEvents = True
    End If
    End Sub
    Joe

    When I was a young man I knew everything. Now that I'm older, I realize I know very little, and what I do know, I tend to forget!

  3. #3
    Board Regular muhammad susanto's Avatar
    Join Date
    Jan 2013
    Location
    KPKNL Pekanbaru, Riau
    Posts
    1,304
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Sort Alphabetic and Automatically Update When Added Data

      
    thanks Joe...it's possible without macro/vba?..
    Sembunyikan & rahasiakan amal kebaikan kita sebagaimana kita mahir dalam menyembunyikan aib-aib kita

    Play in Ms Excel 2007 & 2013 on Win 7 32 Bit

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
  •  

 

 
DMCA.com