
Sub Macro1()
Dim i As Long
For i = 8 To 9055
Range(Cells(1, i), Cells(6, i)).Select
ActiveWorkbook.Worksheets("Foglio1").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Foglio1").Sort.SortFields.Add Key:=Range(Cells(1, i), Cells(6, i)) _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Foglio1").Sort
.SetRange Range(Cells(1, i), Cells(6, i))
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Next
End Sub
|
Sub Macro1()
Dim i As Long, c As Long
Dim N As Long
For i = 8 To 9055
Range(Cells(1, i), Cells(6, i)).Select
ActiveWorkbook.Worksheets("Foglio1").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Foglio1").Sort.SortFields.Add Key:=Range(Cells(1, i), Cells(6, i)) _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Foglio1").Sort
.SetRange Range(Cells(1, i), Cells(6, i))
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range(Cells(2, i), Cells(6, i)).Interior.ColorIndex = xlNone
For c = 2 To 6
N = Cells(c, i)
If N = Cells(c + 1, i) Or N = Cells(c - 1, i) Then
If N > -0 Then
Cells(c, i).Interior.ColorIndex = 3
End If
End If
Next
Next
End Sub
|
Range(Cells(2, i), Cells(6, i)).Interior.ColorIndex = xlNone
For c = 2 To 5
If Cells(c, i) = Cells(c + 1, i) Then
Range(Cells(c, i), Cells(c + 1, i)).Interior.ColorIndex = 3
End If
Next c
Next i
End Sub |
