Results 1 to 3 of 3

Thread: Sorting Values automatically when populated from another sheet.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Seeker Jamesba1's Avatar
    Join Date
    Jul 2019
    Posts
    5
    Articles
    0
    Excel Version
    2016

    Sorting Values automatically when populated from another sheet.

    Hi,
    I hope someone can help, be gentle I learning.
    I'm trying to automatically sort the data in Column 2 of Chart. As the values are populated from the Data sheet, I can't see how to have them sorted automatically from smallest to largest.
    I hope this makes sense. Thanks in advance.
    Attached Files Attached Files

  2. #2
    Conjurer Logit's Avatar
    Join Date
    Nov 2016
    Posts
    254
    Articles
    0
    Excel Version
    2007
    Paste this in the Sheet1 Module :

    Code:
    Option Explicit
    
    
    
    Private Sub Worksheet_Activate()
    Dim lastrow As Long
    
    
    lastrow = Cells(Rows.Count, 2).End(xlUp).Row
    Range("A2:B" & lastrow).Sort key1:=Range("B2:B" & lastrow), _
       order1:=xlAscending, Header:=xlYes
    
    
    End Sub
    When the user goes from Sheet DATA to Sheet CHART, the sort will occur automatically.

  3. #3
    Conjurer NormS's Avatar
    Join Date
    Jul 2017
    Posts
    120
    Articles
    0
    Excel Version
    Excel 2016 ProPlus
    If you don't want to use VBA, you can use the SMALL function to sort the values, then match up the names.
    Attached Files Attached Files

Posting Permissions

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