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
|
Dim i As Integer, j As Integer, k As Integer, nbreLignes As Long
Dim Feuillet(1 To 1) As String, Caract(1 To 16) As String, Subst(1 To 16) As String
Dim c As Range
Dim ColNom, ColPrenom As Integer
Dim Nom As String
Nom = InputBox("Quel est le nom du feuillet contenant les caractères à modifier ?", vbQuestion, "")
ColNom = InputBox("Quel est le numéro de la colonne contenant le nom ? (1 pour A, 2 pour B...)", vbQuestion, "")
ColPrenom = InputBox("Quel est le numéro de la colonne contenant le prenom ? (1 pour A, 2 pour B...)", vbQuestion, "")
Caract(1) = "é"
...
Subst(1) = "e"
...
Sheets(Feuillet(1)).Activate
Sheets(Feuillet(1)).Range("A1").Select
nbreLignes = Range(ActiveCell, ActiveCell.End(xlDown)).Count
For k = 1 To 16
For i = 1 To nbreLignes
Set c = Sheets(Feuillet(1)).Cells(i, ColNom).Find(Caract(k))
If Not c Is Nothing Then
Sheets(Feuillet(1)).Cells(i, ColNom).Value = Replace(Sheets(Feuillet(1)).Cells(i, ColNom).Value, Caract(k), Subst(k))
End If
Set c = Sheets(Feuillet(1)).Cells(i, ColPrenom).Find(Caract(k))
If Not c Is Nothing Then
Sheets(Feuillet(1)).Cells(i, ColPrenom).Value = Replace(Sheets(Feuillet(1)).Cells(i, ColPrenom).Value, Caract(k), Subst(k))
End If
Next i
Next k |
Partager