
Sub Welcome1() lun = 3510 'inizializza indici di riga e di colonna r_new = 2 c_new_1 = 1 'colonna a nuovo foglio dove mettere id riga c_new_2 = 2 'colonna nuovo foglio dove mettere nome operatore c_new_3 = 3 'colonna c dove mettere la data c_new_4 = 4 'colonna d dove mettere l'esito c_new_5 = 5 'colonna d dove mettere sblocco c_new_6 = 6 'colonna f dove mettere ID Ana c_new_7 = 7 'colonna g dove mettere Lotto c_old_1 = 14 ' colonna n del foglio Svolti c_old_2 = 2 ' colonna b del foglio Svolti c_old_3 = 3 ' colonna c del foglio Svolti c_old_4 = 15 ' colonna o del foglio Svolti c_old_5 = 16 ' colonna p del foglio Svolti c_old_6 = 5 ' colonna e del foglio Svolti c_old_7 = 1 ' colonna a del foglio Svolti Foglio_old = "Svolti" Foglio_new = "DBWlc" 'iterazione su tutte le righe della colonna a (c_old_7) r_old_start = 2 r_old_end = lun For r_old = r_old_start To r_old_end 'per tutte le righe del foglio Svolti a partire dalla 2 per tutta la lun If Sheets(Foglio_old).Cells(r_old, c_old_7).Value <> "" Then 'se nel foglio Welcome la cella di coordinate r_old (2) c_old_6 (a) è diverso da vuoto allora.. Sheets(Foglio_old).Cells(r_old, c_old_1).Copy Sheets(Foglio_new).Cells(r_new, c_new_1).PasteSpecial xlPasteValues '..seleziona la celle del foglio Sheet1 della colonna "n" (c_old_1) della riga (r_old) corrispondente 'a quella in cui il valore della colonna a è stato trovato <>"" e copialo e incollalo sulla colonna c_new_1 Sheets(Foglio_old).Cells(r_old, c_old_2).Copy Sheets(Foglio_new).Cells(r_new, c_new_2).PasteSpecial xlPasteValues Sheets(Foglio_old).Cells(r_old, c_old_3).Copy Sheets(Foglio_new).Cells(r_new, c_new_3).PasteSpecial xlPasteValues Sheets(Foglio_old).Cells(r_old, c_old_4).Copy Sheets(Foglio_new).Cells(r_new, c_new_4).PasteSpecial xlPasteValues Sheets(Foglio_old).Cells(r_old, c_old_5).Copy Sheets(Foglio_new).Cells(r_new, c_new_5).PasteSpecial xlPasteValues Sheets(Foglio_old).Cells(r_old, c_old_6).Copy Sheets(Foglio_new).Cells(r_new, c_new_6).PasteSpecial xlPasteValues Sheets(Foglio_old).Cells(r_old, c_old_7).Copy Sheets(Foglio_new).Cells(r_new, c_new_7).PasteSpecial xlPasteValues 'Sheets(Foglio_new).Select 'ActiveSheet.Paste r_new = r_new + 1 End If Next r_old End Sub |
Sub a()
With Sheets("Svolti")
LR = .Cells(Rows.Count, 14).End(xlUp).Row
.Range(.Cells(2, 14), .Cells(LR, 14)).Copy Sheets("DBWlc").Cells(2, 1)
.Range(.Cells(2, 2), .Cells(LR, 2)).Copy Sheets("DBWlc").Cells(2, 2)
.Range(.Cells(2, 3), .Cells(LR, 3)).Copy Sheets("DBWlc").Cells(2, 3)
.Range(.Cells(2, 15), .Cells(LR, 15)).Copy Sheets("DBWlc").Cells(2, 4)
.Range(.Cells(2, 16), .Cells(LR, 16)).Copy Sheets("DBWlc").Cells(2, 5)
.Range(.Cells(2, 5), .Cells(LR, 5)).Copy Sheets("DBWlc").Cells(2, 6)
.Range(.Cells(2, 1), .Cells(LR, 1)).Copy Sheets("DBWlc").Cells(2, 7)
End With
LR = Cells(Rows.Count, "A").End(xlUp).Row
End Sub |
Sub a()
Application.ScreenUpdating = False
With Sheets("Svolti")
LR = .Cells(Rows.Count, 14).End(xlUp).Row
.Range(.Cells(2, 14), .Cells(LR, 14)).Copy Sheets("DBWlc").Cells(2, 1)
.Range(.Cells(2, 2), .Cells(LR, 2)).Copy Sheets("DBWlc").Cells(2, 2)
.Range(.Cells(2, 3), .Cells(LR, 3)).Copy Sheets("DBWlc").Cells(2, 3)
.Range(.Cells(2, 15), .Cells(LR, 15)).Copy Sheets("DBWlc").Cells(2, 4)
.Range(.Cells(2, 16), .Cells(LR, 16)).Copy Sheets("DBWlc").Cells(2, 5)
.Range(.Cells(2, 5), .Cells(LR, 5)).Copy Sheets("DBWlc").Cells(2, 6)
.Range(.Cells(2, 1), .Cells(LR, 1)).Copy Sheets("DBWlc").Cells(2, 7)
For c = 17 To 46 Step 3
LR1 = Sheets("DBWlc").Cells(Rows.Count, 2).End(xlUp).Row + 1
LR = .Cells(Rows.Count, c).End(xlUp).Row
.Range(.Cells(2, c), .Cells(LR, c)).Copy Sheets("DBWlc").Cells(LR1, 1)
.Range(.Cells(2, 2), .Cells(LR, 2)).Copy Sheets("DBWlc").Cells(LR1, 2)
.Range(.Cells(2, 3), .Cells(LR, 3)).Copy Sheets("DBWlc").Cells(LR1, 3)
.Range(.Cells(2, 15), .Cells(LR, 15)).Copy Sheets("DBWlc").Cells(LR1, 4)
.Range(.Cells(2, 16), .Cells(LR, 16)).Copy Sheets("DBWlc").Cells(LR1, 5)
.Range(.Cells(2, 5), .Cells(LR, 5)).Copy Sheets("DBWlc").Cells(LR1, 6)
.Range(.Cells(2, 1), .Cells(LR, 1)).Copy Sheets("DBWlc").Cells(LR1, 7)
Next
End With
LR1 = Sheets("DBWlc").Cells(Rows.Count, 2).End(xlUp).Row
With Sheets("DBWlc")
For r = LR1 To 2 Step -1
If Cells(r, 1) = "" Then Rows(r).Delete
Next
End With
Application.ScreenUpdating = True
End Sub
|
