Bonjour !
A partir de la fonctionnalité de recherche d'Excel et telle qu'expliquée dans l'aide VBA interne de Range.Find
donc d'un niveau débutant :
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| Sub Demo1()
Dim Rg As Range
Application.ScreenUpdating = False
With Cells(1).CurrentRegion.Columns(3)
Set Rg = .Find("*-A", , xlValues, xlWhole)
If Not Rg Is Nothing Then
Do
Rg.Value = Left(Rg.Value, Len(Rg.Value) - 2)
Set Rg = .FindNext(Rg)
Loop Until Rg Is Nothing
End If
End With
Application.ScreenUpdating = True
End Sub |
Une autre voie :
1 2 3 4 5 6 7 8 9
| Sub Demo2()
Dim V, R&
V = Cells(1).CurrentRegion.Columns(3).Value
Application.ScreenUpdating = False
For R = 1 To UBound(V)
If V(R, 1) Like "*-A" Then Cells(R, 3).Value = Left(V(R, 1), Len(V(R, 1)) - 2)
Next
Application.ScreenUpdating = True
End Sub |
___________________________________________________________________________________________________________
Merci de cliquer sur
en bas à droite de chaque message ayant aidé puis sur
pour clore cette discussion …
___________________________________________________________________________________________________________ Je suis Paris, Egypte, Nigeria, New-York, Mogadicio, Barcelone, London, Manchester, Stockholm, Istanbul, Berlin, Nice, Bruxelles, Charlie, …
Partager