Sub Macro1()
'
' Macro1 Macro
'
' Scelta rapida da tastiera: CTRL+a
'
Sheets("DATI DA ELABORARE").Select
Sheets("DATI DA ELABORARE").Name = "DATI DA ELABORARE"
Sheets("DATI DA ELABORARE").Select
ActiveWorkbook.Worksheets("DATI DA ELABORARE").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("DATI DA ELABORARE").AutoFilter.Sort.SortFields.Add _
Key:=Range("A6:A1048576"), SortOn:=xlSortOnValues, Order:=xlAscending, _
DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("DATI DA ELABORARE").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
ActiveWorkbook.Worksheets("DATI DA ELABORARE").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("DATI DA ELABORARE").AutoFilter.Sort.SortFields.Add _
Key:=Range("B6:B1048576"), SortOn:=xlSortOnValues, Order:=xlAscending, _
DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("DATI DA ELABORARE").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
ActiveSheet.Range("$A$6:$E$1048576").AutoFilter Field:=3, Criteria1:=Array( _
"01.001.1", "01.001.3", "01.001.4", "01.002.2", "01.003.1", "01.003.3", "01.003.4", _
"01.003.8", "01.004.2", "01.004.3", "01.004.4", "01.006.3", "01.006.4", "01.006.5", _
"01.006.6", "01.008.1", "01.008.3", "01.008.4", "01.010.3", "01.010.4", "01.010.5", _
"01.010.6", "01.012.3", "01.012.4", "01.013.3", "01.013.4", "01.014.3", "01.014.4", _
"01.015.3", "01.015.4", "01.016.1", "01.016.3", "01.016.4", "01.016.8", "01.017.3", _
"01.017.4", "01.018.1", "01.018.3", "01.018.4", "01.018.5", "01.018.8", "01.019.4", _
"01.019.5", "01.020.4", "01.021.3", "01.102.1", "01.102.2", "01.102.3", "01.103.1", _
"01.103.2", "01.103.3", "01.103.4", "01.103.5", "01.103.6", "01.104.1", "01.104.3", _
"01.104.4", "01.104.6", "01.105.2", "01.105.3", "01.107.3", "01.107.4", "01.108.2", _
"01.110.1", "01.110.4", "01.111.2", "01.111.3", "01.113.1", "01.160.1", "01.160.2", _
"01.160.3", "01.160.4", "01.165.1", "01.165.2", "01.165.3", "01.165.4", "01.182.1", _
"01.182.2", "01.201.4", "01.201.5", "01.201.6", "01.201.7", "01.205.3", "01.205.7"), _
Operator:=xlFilterValues
Range("A7").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Application.Run "COPIA_SOLO_CELLE_VISIBILI"
Selection.Copy
Sheets("1a ELABORAZIONE").Select
Range("A7").Select
ActiveSheet.Paste
ActiveSheet.Range("$F$6:$I$1048576").AutoFilter Field:=1, Criteria1:="<>"
Range("A7:E7").Select
Range(Selection, Selection.End(xlDown)).Select
Application.Run "COPIA_SOLO_CELLE_VISIBILI"
Application.CutCopyMode = False
Selection.Copy
Sheets("DATI SMN").Select
Range("A7").Select
ActiveSheet.Paste
Sheets("1a ELABORAZIONE").Select
ActiveSheet.Range("$F$6:$I$1048576").AutoFilter Field:=1
ActiveSheet.Range("$F$6:$I$1048576").AutoFilter Field:=2, Criteria1:="<>"
Range("A7:E7").Select
Range(Selection, Selection.End(xlDown)).Select
Application.Run "COPIA_SOLO_CELLE_VISIBILI"
Application.CutCopyMode = False
Selection.Copy
Sheets("DATI SMN").Select
Range("A7").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
ActiveSheet.Paste
ActiveWorkbook.Worksheets("DATI SMN").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("DATI SMN").AutoFilter.Sort.SortFields.Add Key:= _
Range("A6"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("DATI SMN").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
ActiveWorkbook.Worksheets("DATI SMN").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("DATI SMN").AutoFilter.Sort.SortFields.Add Key:= _
Range("B6"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("DATI SMN").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
ActiveWorkbook.Worksheets("DATI SMN").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("DATI SMN").AutoFilter.Sort.SortFields.Add Key:= _
Range("D6"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("DATI SMN").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Sheets("1a ELABORAZIONE").Select
ActiveSheet.Range("$F$6:$I$1048576").AutoFilter Field:=2
ActiveSheet.Range("$F$6:$I$1048576").AutoFilter Field:=3, Criteria1:="<>"
Range("A7:E7").Select
Range(Selection, Selection.End(xlDown)).Select
Application.Run "COPIA_SOLO_CELLE_VISIBILI"
Selection.Copy
Sheets("DATI VCO").Select
Range("A7").Select
ActiveSheet.Paste
Sheets("1a ELABORAZIONE").Select
ActiveSheet.Range("$F$6:$I$1048576").AutoFilter Field:=3
ActiveSheet.Range("$F$6:$I$1048576").AutoFilter Field:=4, Criteria1:="<>"
Range("A7:E7").Select
Range(Selection, Selection.End(xlDown)).Select
Application.Run "COPIA_SOLO_CELLE_VISIBILI"
Application.CutCopyMode = False
Selection.Copy
Sheets("DATI VCO").Select
Range("A7").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
ActiveSheet.Paste
ActiveWorkbook.Worksheets("DATI VCO").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("DATI VCO").AutoFilter.Sort.SortFields.Add Key:= _
Range("A6"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("DATI VCO").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
ActiveWorkbook.Worksheets("DATI VCO").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("DATI VCO").AutoFilter.Sort.SortFields.Add Key:= _
Range("B6"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("DATI VCO").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
ActiveWorkbook.Worksheets("DATI VCO").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("DATI VCO").AutoFilter.Sort.SortFields.Add Key:= _
Range("D6"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("DATI VCO").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Sheets("1a ELABORAZIONE").Select
ActiveSheet.Range("$F$6:$I$1048576").AutoFilter Field:=4
Range("A7:E7").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents
Sheets("DATI DA ELABORARE").Select
ActiveSheet.Range("$F$6:$I$1048576").AutoFilter Field:=3
Range("A7:E7").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents
Sheets("CARICARE I PRIMI DATI").Select
Range("A1:E1").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents
End Sub |