Sorting a worksheet

  • Thread starter Thread starter Dan Wilson
  • Start date Start date
D

Dan Wilson

Good day. I am using Excel 2002. I have a workbook that
is used to receive an Items List from Quickbooks. Since
Quickbooks does not have the ability to sort the Items
List the way I want it, I have to do the sort when I open
the Excel workbook.

Is there a way to invoke a macro by selecting a particular
cell in a worksheet? Perhaps the empty cell above Row 1
and left of Cell A? This would be the ideal spot although
any empty cell will work.

Thanks, Danno...
 
Dan

I have provided 2 examples on how to run a macro when a cell/s i
selected.

These codes are triggered whenever a new cell or range of cells i
selected.



1st example will checks if all cells are selected
2nd example checks if a1 is selected


Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
If Target.Columns.Count = Columns.Count And Target.Rows.Count
Rows.Count Then
your sort code here
End If
End Sub



or


Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
If Target.Address = "$A$1" Then
your sort code here
End If
End Su
 
Good day Mudraker,

Thanks for the quick response. I will try them both.

Thanks, Danno...
 
Back
Top