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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
Dim tableau
Dim valeur
Sub menu()
resetmenu
Dim SYMB
SYMB = Array(",", ";", ":", ".", "|", "-", "_", " ")
nomsymb = Array("vir "",""", "Pointvir "";""", "2 points "":""", "point "".""", "barre ""|""", "petit tiret ""-""", "grand tiret ""_""", "espace "" """)
'CommandBars("cell").Reset
Set newpop = CommandBars("cell").Controls.Add(Type:=msoControlPopup, before:=1)
With newpop
.Caption = "copier comme tableau par ": Set bout = newpop.Controls.Add(Type:=msoControlButton): With bout: .Caption = "SEPARATEUR": .Enabled = False: End With
For i = 0 To UBound(SYMB)
Set bout = newpop.Controls.Add(Type:=msoControlButton)
With bout
.Caption = nomsymb(i)
.Tag = SYMB(i)
.OnAction = "copie"
End With
Next
End With
Set newpop = CommandBars("cell").Controls.Add(Type:=msoControlPopup, before:=2)
With newpop
.Caption = "coller tableau en mode": Set bout = newpop.Controls.Add(Type:=msoControlButton): With bout: .Caption = "TRANSPOSITION": .Enabled = False: End With
Set bout = newpop.Controls.Add(Type:=msoControlButton)
With bout: .Caption = "vertical": .Tag = 1: .OnAction = "colle": End With
Set bout = newpop.Controls.Add(Type:=msoControlButton)
With bout: .Caption = "Horizontal": .Tag = 2: .OnAction = "colle": End With
End With
End Sub
Sub copie()
Dim SEP
SEP = CommandBars.ActionControl.Tag
tableau = Split(Selection.Value, SEP)
resetmenu
End Sub
Sub colle()
sens = CommandBars.ActionControl.Tag
Select Case sens
Case 1: With Range(ActiveCell, ActiveCell.Offset(UBound(tableau), 0)): .NumberFormat = "@": .Value = Application.Transpose(tableau): End With
Case 2: With Range(ActiveCell, ActiveCell.Offset(0, UBound(tableau))): .NumberFormat = "@": .Value = tableau: End With
End Select
resetmenu
End Sub
Sub resetmenu()
CommandBars("cell").Reset
End Sub |
Partager