+ Reply to Thread
Results 1 to 1 of 1

Adding a sort button using VBA

  1. #1
    Registered User
    Join Date
    10-16-2011
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    6

    Adding a sort button using VBA

    Hi,

    I am trying to sort data by clicking on the column headers of a table

    so far, the data will sort but it sorts when you click on any of the column cells. I would like
    to be able to just click on the headers, so that:

    Name = by forename A to Z
    Year = 2, 1 then Fn
    Class = Emerald, Gold, Ruby, Sapphire, Amber, Aqua, Crimson, Turquoise, Blue, Green, Purple, Red, Yellow
    SEN Stage = Statement, School Action+, School Action + (SALT), School Action, Initial Concern

    At the moment, when I click on the Year column header, it sorts in the order of 1, 2, Fn or Fn, 2, 1 (I would like, Fn, 1, 2 and 2, 1, Fn)

    I am rather out of my depth here, any help would be grately appreciated!

    Here is a link to the file
    https://www.box.com/s/8161b2f9bd8213e86ba3

    PS.
    When I protect the cells and then click on them to test if they are locked I get this message "Debugging"
    and this line of the code is highlighted in Yellow;

    Target.CurrentRegion.Sort key1:=Target, order1:=MySortType, Header:=xlYes

    Regards,

    Matt
    Last edited by mj_bowen; 06-17-2012 at 10:12 AM.

+ Reply to Thread

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