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
| Sub Export_txt()
'Variable dernière ligne
Dim dl As Long
dl = Range("A" & Rows.Count).End(xlUp).Row
'Désactive le rafraichissement
Application.ScreenUpdating = False
'Sélectionne derniere ligne vide
If Range("A1") = "" Then
Range("A1").Select
Else
Range("A" & dl + 1).Select
End If
' colle presse papier
ActiveSheet.PasteSpecial Format:="Texte Unicode", Link:=False, _
DisplayAsIcon:=False
' Sépare les colonnes
Columns("A:A").Select
selection.TextToColumns Destination:=Range("A1"), DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 1), Array(12, 1), Array(19, 1), Array(22, 1), Array(28, 1), _
Array(32, 1), Array(41, 1), Array(45, 1), Array(54, 1), Array(59, 1)), _
TrailingMinusNumbers:=True
' Supprime les colonnes inutiles
Range("A:E,G:G,I:J").Select
selection.Delete Shift:=xlToLeft
' Sélectionne et remplace les points dans la sélection
Range("A1").CurrentRegion.Select
Dim s
s = selection.Value
s = Application.Substitute(s, ",", ".")
selection.Value = s
'Réactive le rafraichissement
Application.ScreenUpdating = False
End Sub |
Partager