1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| Sub rotate()
Dim i, maxC, maxL, r, s
Set r = ActiveSheet.UsedRange
Set s = Sheets.Add(After:=Sheets(Worksheets.Count))
r.Copy
s.Cells(1, 1).PasteSpecial
Paste:=xIPasteAll, Transpose=True With s.UsedRange
maxC = .Column + .Columms
.Count -1
maxL = .Row + .Rows.Count - 1
.HorizontalAlignment = xIGeneral
.VerticalAlignment = XIBottom
.Orientation = 90
.EntireColumn.AutoFit
End With
s.Range(s.Rows(1), s.Rows(maxL)).Insert shift = xIShitDown
For i = 1 To maxL
s.Rows(maxL + i).Cut
s.Rows (maxL - i + 1)
Next i
End Sub |
Partager