Vous êtes sur la page 1sur 3

Sub compterMots()

Dim texte As String, mots() As String, nbmots As Long

texte = InputBox("votre chaine de caracteres ici")

mots = Split(texte, " ")

mots = Split(texte, " ")

nbmots = UBound(mots) + 1

MsgBox "nombre de mots : " & nbmots

End Sub

Sub convertirEnMajuscules()

Dim texte As String

texte = InputBox("entrer votre chaine de caractères ici")

Range("A1").Value = UCase(texte)

End Sub

Sub extrairepartie()

Dim texte As String, debut As Long, fin As Long

texte = InputBox("entrer votre chaine de caractère")

debut = 1

fin = 10

MsgBox Mid(texte, debut, fin - debut + 1)

End Sub

Sub supprimerEsp()

Dim texte As String

texte = InputBox("entre votre chaine")

texte = Replace(texte, " ", "")

MsgBox (texte)
End Sub

Sub verisouschaine()

Dim texte As String

texte = InputBox("taper votre chaine de cara")

If InStr(texte, "sous-chaîne") > 0 Then

MsgBox "la chaine contient la sous-chaine."

End If

MsgBox "la chaine ne contient pas la sous-chaine."

End Sub

Sub ConvertirEnChaine()

Dim valeur As Double

valeur = InputBox("votre valeur num")

msgbox typeName (valeur)

chain = Cstr(valeur)
msgBox typeName (valeur)

End Sub

Sub InsererSousChaine()

Dim texte As String

Dim position As Long

texte = InputBox("Votre chaîne de caractères ici")

position = 7 ' Position d'insertion

texte = Left(texte, position - 1) & "sous-chaîne à insérer" & Mid(texte, position)

MsgBox texte

End Sub

Sub SupprimerSousChaine()

Dim texte As String

texte = InputBox("Votre chaîne de caractères ici")

texte = Replace(texte, "je danse", "")

MsgBox texte
End Sub

Sub InverserChaine()

Dim texte As String

Dim i As Long

texte = InputBox("Votre chaîne de caractères ici")

For i = Len(texte) To 1 Step -1

texteInverse = texteInverse & Mid(texte, i, 1)

Next

End Sub

Vous aimerez peut-être aussi