In pratica ho la necessità ,quando vado a copiare le celle da un foglio (riepilogo ordini) all'altro (ordini)
di aggiungere una colonna (la M) con tutte le celle = al nome del file , e questo per tutte le celle piene.
allego la macro
- Codice: Seleziona tutto
Sub DAARRIVARE()
Set Ws1 = Sheets("RIEPILOGO ORDINI")
Set Ws2 = Sheets("DA ARRIVARE")
UC = Ws1.Cells(2, Columns.Count).End(xlToLeft).Column
Application.ScreenUpdating = False
Application.Calculation = xlManual
Ws2.Cells.Clear
For CC = 1 To UC - 12 Step 11
Ws1.Range(Ws1.Cells(3, CC), Ws1.Cells(150, CC + 10)).Copy Destination:=Ws2.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
Next CC
Ws1.Range("A1:E1").Copy Destination:=Ws2.Range("A1")
Ws1.Range("F2:k2").Copy Destination:=Ws2.Range("F1")
UR2 = Ws2.Range("A" & Rows.Count).End(xlUp).Row
For RR2 = UR2 To 2 Step -1
If Ws2.Range("C" & RR2).Value = 0 Or Ws2.Range("h" & RR2).Value = 0 Or Ws2.Range("K" & RR2).Value <> 0 Then Ws2.Rows(RR2).Delete
Next RR2
myMatch = Application.Match(CLng(Int(Now)), Range("K:K"))
If Not IsError(myMatch) Then
Cells(myMatch, 1).Offset(1, 0).Resize(10000, 10).ClearContents
End If
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub