Bonjour à toutes et à tous,
Merci à ceux qui prendront un peu de leur tps pour m'aider.
j'importe une colonne d'un logiciel et cette colonne est avec 000 devant. Je sélectionne cette colonne puis click gauche et j'appuie sur le petit ! jaune et click sur convertir en nombre. Y aurait il un moyen via une macro de convertir cette colonne de façon auto.
Sub modif()
tablo = Range("A3:A" & Range("A" & Rows.Count).End(xlUp).Row)
For n = LBound(tablo, 1) To UBound(tablo, 1)
tablo(n, 1) = tablo(n, 1) * 1
Next
Range("A3:A" & Range("A" & Rows.Count).End(xlUp).Row) = tablo
End Sub
On peut la chose manuellement avec Données/Convertir
Puis Format/Standard
Ci-dessous l'équivalent (dispensable) VBA de la manip décrite plus haut
VB:
Sub Macro1()
Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, FieldInfo:=Array(1, 1)
Selection.NumberFormat = "General"
End Sub
Sub test()
With Range("A3:A" & Range("A" & Rows.Count).End(xlUp).Row)
.Value = .Value
End With
End Sub
Sinon, y aurait bien une solution avec des CreateObject("wscript.shell").SendKeys "{F2}" et CreateObject("wscript.shell").SendKeys "{ENTER}" mais ça me parait plus... "Usine à gaz".