Results 1 to 3 of 3

VB Code to sort the list in ascending order

Threaded View

rizmomin VB Code to sort the list in... 12-22-2015, 10:53 AM
nilem Re: VB Code to sort the list... 12-22-2015, 11:01 AM
rizmomin Re: VB Code to sort the list... 12-22-2015, 12:08 PM
  1. #1
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    VB Code to sort the list in ascending order

    Hello:

    Please refer to attached file.
    I am using below VB Code to sort the list in Ascending order instantly once the Name is added in column B.

    Dim LastRow As Long
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
        LastRow = Range("A" & Rows.Count).End(xlUp).Row
        'MsgBox "LastRow" & LastRow
        
        
        
        Range("A1:A" & LastRow).Sort Key1:=Range("B1"), Order1:=xlAscending, Header:=xlGuess, _
                                     OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal
    End Sub
    I am getting error.
    Would appreciate help to correct the code.
    Let me know if you have any questions.
    Thanks.
    Riz
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Sort dates in ascending order of day
    By mso3 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-08-2015, 08:05 AM
  2. Sort the final digits and sort in ascending order
    By jorel in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-29-2014, 11:58 AM
  3. [SOLVED] Sort in ascending order
    By Glenn Kennedy in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-07-2013, 08:11 AM
  4. [SOLVED] Sort Ascending order
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-16-2013, 02:27 PM
  5. [SOLVED] Sort in ascending order
    By Dibbley247 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 03-17-2013, 12:30 AM
  6. [SOLVED] Sort PivotFields in Ascending Order
    By jomili in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-04-2012, 04:27 PM
  7. sort ascending order
    By iscar_marius in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 02-11-2009, 11:00 AM

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