Results 1 to 2 of 2

Automatic Update of Sort Key Column in Excel VBA

Threaded View

  1. #1
    Registered User
    Join Date
    09-17-2008
    Location
    Europe
    Posts
    48

    Automatic Update of Sort Key Column in Excel VBA

    Hi,

    I'm trying to create a code whereby when a user updates one of many tables that are found in the 'Tables' sheet, the relevant table automatically sorts once a cell is updated.

    The code below is working fine, however, i would like to also automatically change the sort key from "A1", to reflect the correct sort key of the table that the user selected. For eg. if the user is updating the content of a table found in column "J", I would like the "Sort key1:=Range" to automatically reflect "J1" in my code.

    Below is my code:

    Sub Auto_Open()
    
        ThisWorkbook.Worksheets("Tables").OnEntry = "SortLists"
    
            
            
    End Sub
    
    -------------------------------------------------------------
    
    
    Sub sortlists()
        Dim currcell As Range
        Set currcell = Application.Caller
        
                
            Selection.Sort key1:=Range("A1"), _
            order1:=xlAscending, _
            Header:=xlYes, _
            MatchCase:=False, _
            Orientation:=xlTopToBottom
            
    
    End Sub
    regards,
    Last edited by makku; 11-02-2011 at 06:58 AM.

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