Rem Attribute VBA_ModuleType=VBAModule
Option VBASupport 1
Option Explicit
Sub Conversion_texte_Nombre() 'Converti le format texte en format nombre
Dim Z As Range 'Selection à convertir
Dim ongl As String 'Feuille
Dim col As String 'Colonne
Dim derli As Integer 'Dernière ligne de la colonne
Dim Cellule As Range
Dim Colonne As String
Dim i As Long
On Error GoTo erreurfeuille
ongl = InputBox("Saisir le nom de la feuille de travail.", _
Title:="Onglet à traiter", Default:="1")
Sheets(ongl).Select
col = InputBox("Saisir la colonne à modifier.", _
Title:="Colonne à convertir", Default:="K")
Colonne = Replace(Colonne, "$", "")
For i = 1 To Len(Colonne)
If IsNumeric(Mid(Colonne, i, 1)) Then
Exit For
Else
col = col & Mid(Colonne, i, 1)
End If
Next i
With Sheets(ongl)
For Each Cellule In .Range(col & 2 & ":" & col & .Range(col & "65536").End(xlUp).Row)
Cellule = Replace(Cellule, Chr(130), Chr(44))
If IsNumeric(Cellule) Then
Cellule = CDbl(Cellule)
End If
Next Cellule
End With
Exit Sub
erreurfeuille:
MsgBox ("Ce nom n'existe pas !"), vbCritical
End Sub