Bonjour,

mon code identifie dans des chaines de caractères certains caractères et selon les caractères identifiés renvoie une réponse différente.

Lorsque le programme s'exécute les chaines de caractères examinées passent dans tous les cas de ma boucle et comme mes chaines sont très longues, ils peut y avoir plusieurs cas possibles et brouiller la réponse attendue.

Je voudrais que lorsque les caractères sont identifiés, le programme passe directement à la ligne suivante de mon tableur excel contenant la chaine de caractères suivante à examiner.

Autrement dit : cherche "INB " si oui retourne le résultat et passe à la chaine de caractère suivante ; si non cherche "eva/" etc etc...

Est ce qu'il ne me manque donc pas quelque chose dans ma boucle de condition ?

Merci d'avance pour votre aide. J'espère être claire. Pardon pour les noms de variables bizarres.

Voici mon code
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
 
 
Private Sub CommandButton1_Click()
 
 Dim i As Integer
 
    Dim Chaine As String
 
    Dim Caract As String * 4
 
    Dim Voyel As String
 
    Dim objRange, cel As Range
    Dim res As Integer
 
Range("C1").EntireColumn.SpecialCells(xlCellTypeConstants).Select
 
For Each objRange In Selection
 
  For i = 1 To Len(objRange)
  Caract = Mid(objRange, i, 4)
 
        Select Case LCase(Caract)
 
        Case "inb "
 
        Voyel = Voyel & Mid(objRange, i, 7)
        objRange.Offset(0, -2).Value = Right(Voyel, 3)
        objRange.Offset(0, -1).Value = Application.WorksheetFunction.VLookup(Val(Right(Voyel, 3)), Sheets("REF").Range("$A$1:$B$95"), 2, False)
 
        Case "eva/"
 
        Voyel = Voyel & Mid(objRange, i, 6)
        objRange.Offset(0, -2).Value = Right(Voyel, 2)
        objRange.Offset(0, -1).Value = Application.WorksheetFunction.VLookup(Val(Right(Voyel, 2)), Sheets("REF").Range("$I$2:$J$9"), 2, False)
 
        Case "udd/"
 
        Voyel = Voyel & Mid(objRange, i, 6)
        objRange.Offset(0, -2).Value = Right(Voyel, 2)
        objRange.Offset(0, -1).Value = Application.WorksheetFunction.VLookup(Val(Right(Voyel, 2)), Sheets("REF").Range("$G$2:$H$10"), 2, False)
 
        Case "cea/"
 
        Voyel = Voyel & Mid(objRange, i, 6)
        objRange.Offset(0, -2).Value = Right(Voyel, 2)
        objRange.Offset(0, -1).Value = Application.WorksheetFunction.VLookup(Val(Right(Voyel, 2)), Sheets("REF").Range("$K$2:$L$7"), 2, False)
 
        Case "dra/"
 
        Voyel = Voyel & Mid(objRange, i, 6)
        objRange.Offset(0, -2).Value = Right(Voyel, 2)
        objRange.Offset(0, -1).Value = Application.WorksheetFunction.VLookup(Val(Right(Voyel, 2)), Sheets("REF").Range("$M$2:$N$6"), 2, False)
 
        Case "nts/"
 
        Voyel = Voyel & Mid(objRange, i, 6)
        objRange.Offset(0, -2).Value = Right(Voyel, 2)
        objRange.Offset(0, -1).Value = Application.WorksheetFunction.VLookup(Val(Right(Voyel, 2)), Sheets("REF").Range("$O$2:$P$15"), 2, False)
 
         Case Else
 
         End Select
 
       Next i
 
 
  Next objRange
 
End Sub