1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| Private Sub worksheet_deactivate()
Call tri
End Sub
Sub tri()
Dim rng As Range
Dim wsh As Object
Set wsh = ThisWorkbook.Worksheets("DATA")
Set rng = wsh.UsedRange
Debug.Print rng.Address(External:=True)
wsh.Sort.SortFields.Clear
rng.Sort key1:=Range("A1"), order1:=xlAscending, DataOption1:=xlSortTextAsNumbers, _
key2:=Range("L1"), order2:=xlAscending, dataoption2:=xlSortNormal, _
Header:=xlYes
rng.Select
Names.Add Name:="TABDATA", RefersTo:="=" & wsh.Name & "!" & Selection.Address
Range("A1").Select
End Sub |
Partager