In questa sub Option Explicit Dim wsOdierno As Worksheet Dim wsAnalyze As Worksheet Dim…
- User
In questa sub Option Explicit
Dim wsOdierno As Worksheet Dim wsAnalyze As Worksheet Dim wsData As Worksheet Dim wsStorico As Worksheet 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 StoricoDim sourceData As Variant Dim destCell As Range
sourceData = wsOdierno.Range("A9:A111").Value Set destCell = wsStorico.Range("A10").End(xlDown).Offset(1, 0) destCell.Resize(UBound(sourceData, 1), UBound(sourceData, 2)).Value = Application.Transpose(sourceData) ' 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 = TrueEnd Sub Ho il problema che l'incollaggio dei dati sul foglio Storico non avviene in orizzontale, bensi in verticale. Dove sta l'errore che commetto ?
- Assistant