Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
can i sort my data automatically without click on "sort" icon
|
#2
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
You can have a change event macro perform the sort.
-- Gary''s Student - gsnu200800 "abolbashaari" wrote: can i sort my data automatically without click on "sort" icon |
#3
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "A:C" '<== change to suit On Error GoTo ws_exit Application.EnableEvents = False If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then Me.Cells.Sort key1:=Me.Range("A1"), order1:=xlAscending, _ key2:=Me.Range("B1"), order2:=xlAscending, _ heder:=xlYes End If ws_exit: Application.EnableEvents = True End Sub 'This is worksheet event code, which means that it needs to be 'placed in the appropriate worksheet code module, not a standard 'code module. To do this, right-click on the sheet tab, select 'the View Code option from the menu, and paste the code in. -- __________________________________ HTH Bob "abolbashaari" wrote in message ... can i sort my data automatically without click on "sort" icon |
#4
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
What is this code and how does it do and how can i inter my data for sorting
automaticlly "Bob Phillips" wrote: Private Sub Worksheet_Change(ByVal Target As Range) Const WS_RANGE As String = "A:C" '<== change to suit On Error GoTo ws_exit Application.EnableEvents = False If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then Me.Cells.Sort key1:=Me.Range("A1"), order1:=xlAscending, _ key2:=Me.Range("B1"), order2:=xlAscending, _ heder:=xlYes End If ws_exit: Application.EnableEvents = True End Sub 'This is worksheet event code, which means that it needs to be 'placed in the appropriate worksheet code module, not a standard 'code module. To do this, right-click on the sheet tab, select 'the View Code option from the menu, and paste the code in. -- __________________________________ HTH Bob "abolbashaari" wrote in message ... can i sort my data automatically without click on "sort" icon |
#5
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
Do what it says, and change some data column A or B, and see what happens.
-- __________________________________ HTH Bob "abolbashari" wrote in message ... What is this code and how does it do and how can i inter my data for sorting automaticlly "Bob Phillips" wrote: Private Sub Worksheet_Change(ByVal Target As Range) Const WS_RANGE As String = "A:C" '<== change to suit On Error GoTo ws_exit Application.EnableEvents = False If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then Me.Cells.Sort key1:=Me.Range("A1"), order1:=xlAscending, _ key2:=Me.Range("B1"), order2:=xlAscending, _ heder:=xlYes End If ws_exit: Application.EnableEvents = True End Sub 'This is worksheet event code, which means that it needs to be 'placed in the appropriate worksheet code module, not a standard 'code module. To do this, right-click on the sheet tab, select 'the View Code option from the menu, and paste the code in. -- __________________________________ HTH Bob "abolbashaari" wrote in message ... can i sort my data automatically without click on "sort" icon |
#6
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
i found error finaly .correct header spell in code.
"Bob Phillips" wrote: Do what it says, and change some data column A or B, and see what happens. -- __________________________________ HTH Bob "abolbashari" wrote in message ... What is this code and how does it do and how can i inter my data for sorting automaticlly "Bob Phillips" wrote: Private Sub Worksheet_Change(ByVal Target As Range) Const WS_RANGE As String = "A:C" '<== change to suit On Error GoTo ws_exit Application.EnableEvents = False If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then Me.Cells.Sort key1:=Me.Range("A1"), order1:=xlAscending, _ key2:=Me.Range("B1"), order2:=xlAscending, _ heder:=xlYes End If ws_exit: Application.EnableEvents = True End Sub 'This is worksheet event code, which means that it needs to be 'placed in the appropriate worksheet code module, not a standard 'code module. To do this, right-click on the sheet tab, select 'the View Code option from the menu, and paste the code in. -- __________________________________ HTH Bob "abolbashaari" wrote in message ... can i sort my data automatically without click on "sort" icon |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Sorting VLookup vs Sorting SumProduct | Excel Discussion (Misc queries) | |||
Sorting | Charts and Charting in Excel | |||
Sorting: Sorting by the First Character | Excel Discussion (Misc queries) | |||
Sorting | Excel Worksheet Functions | |||
Sorting | Excel Discussion (Misc queries) |