title: How do you assign different macros to each command button at the top of each column so that they work independantly from the other macros?
body: <p>I have assigned the following macro to the first column of my spread sheet to sort the information in ascending and descending order. This macro is assigned to the command button and works.</p>
  
  <pre><code>If CommandButton1.Caption = "Click to Sort Ascending" Then
  
  'Sort ascending...
      ActiveWorkbook.Worksheets("daily data drop").Sort.SortFields.Clear
      ActiveWorkbook.Worksheets("daily data drop").Sort.SortFields.Add Key:=Range("A2:A308"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
      With ActiveWorkbook.Worksheets("daily data drop").Sort
          .SetRange Range("A2:Z308")
          .Header = xlGuess
          .MatchCase = False
          .Orientation = xlTopToBottom
          .SortMethod = xlPinYin
          .Apply
      End With
  CommandButton1.Caption = "Click to Sort Decending"
  
  Else
  
  'sort decending
      ActiveWorkbook.Worksheets("daily data drop").Sort.SortFields.Clear
      ActiveWorkbook.Worksheets("daily data drop").Sort.SortFields.Add Key:=Range("A2:A308") _
          , SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
      With ActiveWorkbook.Worksheets("daily data drop").Sort
          .SetRange Range("A1:Z308")
          .Header = xlGuess
          .MatchCase = False
          .Orientation = xlTopToBottom
          .SortMethod = xlPinYin
          .Apply
      End With
  
  CommandButton1.Caption = "Click to Sort Ascending"
  
  End Sub
  </code></pre>
  
  <p>I would like to have all the top headers of each column to have a button that sorts ascending and descending like the macro above, in keeping the row data matched up. Can any one help me with this or have a template that may be useful.</p>