If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
sorting
can i sort my data automatically without click on "sort" icon
|
#2
|
|||
|
|||
sorting
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
|
|||
|
|||
sorting
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
|
|||
|
|||
sorting
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
|
|||
|
|||
sorting
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
|
|||
|
|||
sorting
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 |
Thread Tools | |
Display Modes | |
|
|