1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| Sub test()
transposition_on_other_sheets Sheets(1).Range("A1:f10"), Sheets(2).Range("B3")
End Sub
'
Function transposition_on_other_sheets(plage As Range, desti As Range)
Dim cel As Range, plusL&, plusC&
plusC = desti.Column - 1: plusL = desti.Row - 1 ' au cas ou la transposition ne demarrerait pas en "A1"
desti.Resize(UBound(plage.Value, 2), UBound(plage.Value)) = Application.Transpose(plage.Value)
For Each cel In plage
With desti.Parent.Cells(cel.Column + plusL, cel.Row + plusC)
If cel.Interior.Color <> vbWhite Then .Interior.Color = cel.Interior.Color
.Font.Bold = cel.Font.Bold
.Font.Italic = cel.Font.Italic
.Font.Color = cel.Font.Color
.NumberFormat = cel.NumberFormat
.HorizontalAlignment = cel.HorizontalAlignment
.VerticalAlignment = cel.VerticalAlignment
.WrapText = cel.WrapText
'etc...
'etc...
'reste les bordures et 2/3 details
End With
Next
End Function |