In questo listato Option Explicit

Dim wsOdierno As Worksheet
Dim wsAnalyze As Worksheet
Dim wsData As Worksheet
Dim wsStorico As Worksheet

Sub ToggleApplicationSettings(ByVal enable As Boolean)
    Application.Calculation = IIf(enable, xlCalculationAutomatic, xlCalculationManual)
    Application.ScreenUpdating = enable
    Application.EnableEvents = enable
End Sub

Sub Analyze_Data()
    Dim myRanges() As Range

    ToggleApplicationSettings False

    Set wsOdierno = ThisWorkbook.Worksheets("Odierno")
    Set wsAnalyze = ThisWorkbook.Worksheets("Analyze")
    Set wsData = ThisWorkbook.Worksheets("Data")
    Set wsStorico = ThisWorkbook.Worksheets("Storico")

    CreateRanges myRanges
    Elabora_Dati myRanges
    StoricizzaDatieVar

    ToggleApplicationSettings True
End Sub

Sub CreateRanges(ByRef myRanges() As Range)
    Dim i As Integer
    Dim baseRange As String
    Dim rangesAddresses(1 To 5) As Variant

    baseRange = "E12:E49,E51:E62,E64:E81,E84:E96,E98:E111"

    For i = 1 To 5
        rangesAddresses(i) = Split(Replace(baseRange, "E", Chr(69 + i - 1)), ",")
    Next i

    ReDim myRanges(1 To 5)

    ' Usa Join per creare il range senza usare Union
    For i = 1 To 5
        Set myRanges(i) = wsOdierno.Range(Join(rangesAddresses(i), ","))
    Next i
End Sub

Sub Elabora_Dati(ByRef myRanges() As Range)
    Dim i As Integer

    ToggleApplicationSettings True ' Riabilita solo per la parte visiva

    ' Procedi normalmente con il resto delle operazioni
    For i = 2 To 6
        wsAnalyze.Select
        myRanges(i - 1).Copy wsAnalyze.Range("D13")
        AnalyzeOnly
        Sheets("VAR").Cells(26, i).Resize(11).Value = Application.Transpose(Sheets("Analyze").Range("F10:P10").Value)
    Next i
    
    ToggleApplicationSettings False ' Disabilita di nuovo una volta che la visione non è più richiesta

End Sub


Sub StoricizzaDatieVar()
    Dim myMultiAreaPrice As Range
    Dim wsVAR As Worksheet
    Dim wsDestinations(1 To 5) As Worksheet
    Dim col As Integer
    Dim lastRows As Variant

    ' Copia dati di sicurezza ed immagazzina dati chiusi precedenti
    Set wsVAR = ThisWorkbook.Worksheets("VAR")
    wsVAR.Range("R22:V24").Value = wsVAR.Range("B22:F24").Value

    ' Incolla su Foglio Data
    Set myMultiAreaPrice = Union(wsOdierno.Range("A10:A49"), wsOdierno.Range("A51:A62"), wsOdierno.Range("A64:A81"), wsOdierno.Range("A84:A96"), wsOdierno.Range("A98:A111"))
    myMultiAreaPrice.Copy
    wsData.Range("A1").End(xlDown).Offset(1, 0).PasteSpecial Paste:=xlValues, Transpose:=True

    ' Incolla su Foglio Storico
    wsOdierno.Range("A9:A111").Copy
    wsStorico.Range("A10").End(xlDown).Offset(1, 0).PasteSpecial Paste:=xlValues, Transpose:=True

    ' Incolla su altri fogli
    Set wsDestinations(1) = Sheets("Cass")
    Set wsDestinations(2) = Sheets("Tr")
    Set wsDestinations(3) = Sheets("Tot")
    Set wsDestinations(4) = Sheets("BCC")
    Set wsDestinations(5) = Sheets("Gen")

    lastRows = Array(52, 52, 52, 52, 60) ' Colonna 6 ha 60 righe, le altre 52
    
    OrdinaVAR
    
    For col = 11 To 15
        wsVAR.Range(wsVAR.Cells(3, col), wsVAR.Cells(lastRows(col - 11), col)).Copy
        wsDestinations(col - 10).Range("A10").End(xlDown).Offset(1, 0).PasteSpecial Paste:=xlValues, Transpose:=True
    Next col

    ' Copia dati di sicurezza
    wsVAR.Range("R61:V68").Value = wsVAR.Range("B61:F68").Value
    wsVAR.Range("B61:F68").Value = wsVAR.Range("B53:F60").Value

    Sheets("Gen").Select
    Application.ScreenUpdating = True
End Sub

Sub OrdinaVAR()
    Dim ws As Worksheet
    Dim i As Long
    Dim sourceRange As Range
    Dim destRange As Range
    Dim lookupValue As Variant
    Dim lookupRange As Range
    Dim foundCell As Range
    Dim rowIndex As Long
    Dim cell As Range
    
    Set ws = ThisWorkbook.Sheets("VAR")
    Set lookupRange = ws.Range("G3:G52") ' Esteso a 52
    rowIndex = 3 ' Iniziare dalla riga 3 per l'intervallo di destinazione

    For Each cell In ws.Range("K26:O52") ' Esteso a 52
        If IsNumeric(cell.Value) And cell.Value > 1000 Then
            cell.Value = Application.WorksheetFunction.MRound(cell.Value, 1000)
        End If
    Next cell

    For i = 3 To 52 ' Esteso a 52
        lookupValue = ws.Cells(i, 8).Value ' Valore in H3:H52
        Set destRange = ws.Range("J" & rowIndex & ":O" & rowIndex)
        
        If Not IsEmpty(lookupValue) Then
            Set foundCell = lookupRange.Find(lookupValue, LookIn:=xlValues, LookAt:=xlWhole)
            
        If Not foundCell Is Nothing Then
                Set sourceRange = ws.Range("A" & foundCell.Row & ":F" & foundCell.Row)
                sourceRange.Copy
                destRange.PasteSpecial Paste:=xlPasteValues
                destRange.PasteSpecial Paste:=xlPasteFormats
            Else
                destRange.ClearContents ' Svuota se non c'è corrispondenza
            End If
        Else
            destRange.ClearContents ' Svuota se il valore è vuoto
        End If

        For Each cell In ws.Range("K26:O52") ' Esteso a 52
            If IsNumeric(cell.Value) And cell.Value > 1000 Then
                cell.Value = Application.WorksheetFunction.MRound(cell.Value, 1000)
            End If
        Next cell

        rowIndex = rowIndex + 1 ' Incrementa l'indice di riga per l'intervallo di destinazione
    Next i
    
    ws.Range("F53:F60").Copy
    ws.Range("O53:O60").PasteSpecial Paste:=xlPasteValues
    ws.Range("O53:O60").PasteSpecial Paste:=xlPasteFormats
    
    ' Pulisci gli appunti
    Application.CutCopyMode = False
End Sub    nella sub ordinaVar viene eseguito l'ordinamento su un blocco specifico.    For Each cell In ws.Range("K26:O52") ' Esteso a 52
            If IsNumeric(cell.Value) And cell.Value > 1000 Then
                cell.Value = Application.WorksheetFunction.MRound(cell.Value, 1000)
            End If
        Next cell  Io ora vorrei cambiare la procedura, chiedendo di fare l'arrotondamento non in un blocco, ma passo dopo passo in ogni procedura di copia. Quindi nel ciclo For vorrei che fosse eseguita la copia dato e successivamente l'arrotondamento, next copia e arrotondamento, etc. Mi puoi riscrivere la sub Ordina Var in tal senso ?