Private Sub ValiderCreerOperation_Click()
Dim ListeCaractèresAccents As String
Dim ListecaractèresSansAccent As String
Dim NewTexte, LibelléOpération As String
Dim RefOperationsSources_Ligne, RefOperationsSources_Colonne, NumeroLigneDernOpérations_FeuilleSources, NbOperationSource As String
ListeCaractèresAccents = "ÀÁÂÃÄÅàáâãäåÒÓÔÕÖØòóôõöøÈÉÊËèéêëÌÍÎÏìíîïÙÚÛÜùúûüÿÑñÇç"
ListecaractèresSansAccent = "AAAAAAaaaaaaOOOOOOooooooEEEEeeeeIIIIiiiiUUUUuuuuyNnCc"
'Définition des références utiles à la macro
'La cellule "Opérations" de la feuille "Sources"
RefOperationsSources_Ligne = Worksheets("Sources").Cells.Find("Opérations").Row
RefOperationsSources_Colonne = Worksheets("Sources").Cells.Find("Opérations").Column
'Le n° de ligne de la dernière valeur de la liste d'opérations disponible
NumeroLigneDernOpérations_FeuilleSources = Worksheets("Sources").Cells.Find("Opérations").End(xlDown).Row
'Le nb d'opérations disponibles dans la liste concernée de la feuille "Sources"
NbOperationSource = Worksheets("Sources").Cells.Find("Opérations").End(xlDown).Row - RefOperationsSources_Ligne
'Développement du tableau de conversion de caractères
Dim TableauConversion() As String
ReDim TableauConversion(Len(ListeCaractèresAccents), 2)
For i = 1 To Len(ListeCaractèresAccents)
TableauConversion(i, 1) = Mid(ListeCaractèresAccents, i, 1)
TableauConversion(i, 2) = Mid(ListecaractèresSansAccent, i, 1)
Next i
'Modification des caractères présentant un accent dans "paiment pâr carte"
For j = 1 To Len(ListeCaractèresAccents)
If InStr(1,"paiement pâr carte", TableauConversion(j, 1), vbTextCompare) <> 0 Then
NewTexte = UCase(Replace("paiement pâr carte", TableauConversion(j, 1), TableauConversion(j, 2)))
MsgBox NewTexte
Exit For
End If
Next j
'Création de la nouvelle Opération
For k = 1 To NbOperationSource
LibelléOpération = Worksheets("Sources").Cells(RefOperationsSources_Ligne + k, RefOperationsSources_Colonne).Value
MsgBox LibelléOpération
MsgBox NewTexte
MsgBox UCase(LibelléOpération)
MsgBox NewTexte Like UCase(LibelléOpération)
'If NewTexte Like UCase(LibelléOpération) = True Then
' MsgBox "Cette opération existe déjà"
' CreaOperation.NomOperation.Value = ""
' Exit Sub
'End If
Next k