1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| Sub CopieTranspose()
Dim Copie As String, tableau() As String, N As Integer, L&, C&
With New DataObject: .GetFromClipboard: Copie = .GetText(1): End With
Application.ScreenUpdating = False
With Selection: .Value = Copie: End With
If Application.OperatingSystem Like "Windows*" Then retour = Chr(10) Else retour = vbNewLine
tableau = Split(Selection, retour)
For N = 0 To UBound(tableau)
With Cells(Selection.Row + N, Selection.Column)
'.NumberFormat = "@"
.Value = tableau(N)
End With
Next
L = UBound(tableau) + 1
C = UBound(Split(Selection.Resize(1).Value, " ")) + 1
Selection.Resize(L).Select
Selection.TextToColumns Selection, Space:=True
VA = Selection.Resize(L, C + 1).Value
Selection.Resize(L, C + 1).ClearContents
With Range(Split(Selection.Address, ":")(0)).Resize(UBound(VA, 2), UBound(VA, 1))
.NumberFormat = "@"
.Value = Application.Transpose(VA)
End With
Application.ScreenUpdating = True
End Sub |
Partager