Ciao,
in risposta a quanto mi avevi proposto:
Ciao
non so se ho capito, prova a sostituire:
Public Sub AggiornaFogli(aWB As Workbook, aRng As Range, i As Long)
Dim destSH As Worksheet
Dim srcRng As Range, destrng As Range
Dim rngFormulas As Range
Dim aCell As Range, rCell As Range
Dim iCtr As Long, Classe As String
For Each rCell In aRng.Cells
If rCell.Value <> vbNullString Then
Set srcRng = rCell.Offset(0, -2).Resize(1, 3)
Set destSH = aWB.Sheets(CStr(rCell.Offset(0, 2).Value))
Classe = rCell.Offset(, 3)
With destSH
.Select
iCtr = 0
Set rngFormulas = destSH.Columns("D").SpecialCells(xlCellTypeFormulas)
For Each aCell In rngFormulas.Cells
iCtr = iCtr + 1
If iCtr = i Then
Set destrng = aCell.End(xlUp)(2).Offset(0, -2).Resize(1, 3)
Exit For
End If
Next aCell
With destrng
.Value = srcRng.Value
If Cells(.Row, 2) <> "" Then Cells(.Row, 1) = Classe
.Offset(1).EntireRow.Insert CopyOrigin:=xlFormatFromLeftOrAbove
End With
End With
End If
Classe = ""
Next rCell
End Sub
Saluti
Volevo chiederti come modificare ulteriormente il codice qualora volessi copiare anche altre 4 colonne a destra della colonna G della scheda mensile, posizionate nelle prime 4 colonne libere sui vari fogli di destinazione.
Grazie dell'aiuto
[Modificato da matteotassi 16/02/2018 11:35]