Una famiglia di software per fogli di calcolo Microsoft con strumenti per l'analisi, la creazione di grafici e la comunicazione dei dati.
Ciao Antonino,
Innanzitutto, penso che sia necessario convertire la tua Discussione ad una Domanda.
Poi, prova qualcosa del genere:
In un modulo standard, incolla il seguente codice:
'=========>>
Option Explicit
'--------->>
Public Sub ORDINADATEF4(Sh As Worksheet)
Dim WB As Workbook
Set WB = ThisWorkbook
arrSheets = Split(sSheets, ",")
On Error GoTo XIT
Application.EnableEvents = False
With Sh
With .Sort
With .SortFields
.Clear
.Add Key:=Sh.Range("K4:K40"), _
SortOn:=xlSortOnValues, _
Order:=xlAscending, _
DataOption:=xlSortNormal
End With
.SetRange Range("A3:M40")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
.Range("I4").FormulaR1C1 = "12:00:00 AM"
.Range("I5").FormulaR1C1 = "=IFERROR(R[-1]C+R[-1]C[1],"""")"
.Range("I5:J5").AutoFill Destination:=.Range("I5:J40"), _
Type:=xlFillDefault
.Range("E4").FormulaR1C1 = "=IFERROR(R[-3]C[-3],"""")"
.Range("E5").FormulaR1C1 = "=IFERROR(R[-1]C[7],"""")"
.Range("E5").AutoFill Destination:=.Range("E5:E40"), _
Type:=xlFillDefault
End With
XIT:
Application.EnableEvents = True
End Sub
'<<=========
Nel modulo di codice dell'oggetto ThisWorkbook, incolla:
'=========>>
Option Explicit
'--------->>
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim rngTabella As Range
Dim arrSheets As Variant
Dim i As Long
Const sSheets As String = "T1,T2,T3,T4,T5,T6,T7,F2,F3,F4,F5,F6,F7,F8,F9"
Const sTabella As String = "A3:M40" '<<=== Modifica
arrSheets = Split(sSheets, ",")
For i = LBound(arrSheets) To UBound(arrSheets)
If UCase(Sh.Name) = UCase(arrSheets(i)) Then
Set rngTabella = Sh.Range(sTabella)
If Not Intersect(Target, rngTabella) Is Nothing Then
Call ORDINADATEF4(Sh)
End If
Exit For
End If
Next i
End Sub
'<<=========
===
Regards,
Norman

