qui
- Codice: Seleziona tutto
For RR1 = 3 To Righe
e qui
- Codice: Seleziona tutto
Sheets("Foglio1").Cells(RR1, CC1).Copy Destination:=Sheets("Foglio2").Cells(Rows.Count, 6).End(xlUp).Offset(1, 0)
ma comunque sostituisci tutta la macro
- Codice: Seleziona tutto
Sub Trasponi()
Righe2 = Sheets("Foglio2").Range("A" & Rows.Count).End(xlUp).Row + 1
Sheets("Foglio2").Range("A1:F" & Righe2).ClearContents
Righe = Sheets("Foglio1").Range("A2").CurrentRegion.Rows.Count
Colonne = Sheets("Foglio1").Range("A2").CurrentRegion.Columns.Count
Sheets("Foglio2").Range("A1").FormulaR1C1 = "item"
Sheets("Foglio2").Range("B1").FormulaR1C1 = "materiale"
Sheets("Foglio2").Range("C1").FormulaR1C1 = "colore"
Sheets("Foglio2").Range("D1").FormulaR1C1 = "Store"
Sheets("Foglio2").Range("E1").FormulaR1C1 = "taglia"
Sheets("Foglio2").Range("F1").FormulaR1C1 = "qtà"
For RR1 = 3 To Righe
For CC1 = 4 To Colonne
colS = Int((CC1 - 4) / 3) * 3
Sheets("Foglio1").Range("A" & RR1 & ":C" & RR1).Copy Destination:=Sheets("Foglio2").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
Sheets("Foglio1").Cells(1, 4 + colS).Copy Destination:=Sheets("Foglio2").Cells(Rows.Count, 4).End(xlUp).Offset(1, 0)
Sheets("Foglio1").Cells(2, CC1).Copy Destination:=Sheets("Foglio2").Cells(Rows.Count, 5).End(xlUp).Offset(1, 0)
Sheets("Foglio1").Cells(RR1, CC1).Copy Destination:=Sheets("Foglio2").Cells(Rows.Count, 6).End(xlUp).Offset(1, 0)
Next CC1
Next RR1
Range("A1").Select
End Sub
Ciao