KeepExploit
XLDnaute Nouveau
Bonjour a tous,
J'ai un fichier qui a de nombreuses procédures avec plein de GoTo, et je les refais au fur et a mesure car les appels commencent à être très long...
J'en ai une en particulier que je ne sais pas comment réécrire
J'ai un fichier qui a de nombreuses procédures avec plein de GoTo, et je les refais au fur et a mesure car les appels commencent à être très long...
J'en ai une en particulier que je ne sais pas comment réécrire
VB:
Sub Macro61()
Application.ScreenUpdating = False
Sheets("ref pièces").Select
doc = InputBox("Type du DOC?")
num = InputBox("N° du DOC?")
rev = InputBox("Rev du DOC?")
Dim a As Integer, b As Integer
a = 2
b = 20
Do While b < 33
line1:
If Cells(a, 1) <> vbNullString Then
If Cells(a, b) = vbNullString Then
a = a + 1
GoTo line1
Else
If Cells(a, 1) <> vbNullString Then
If Cells(a, b) = doc Then
If Cells(a, b + 1) = num Then
Cells(a, b + 2) = "'" & rev
a = a + 1
GoTo line1
Else
a = a + 1
GoTo line1
End If
Else
a = a + 1
GoTo line1
End If
Else
a = a + 1
GoTo line1
End If
End If
End If
a = 2
b = b + 5
Loop
a = 2
b = 36
Do While b < 49
line2:
If Cells(a, 1) <> vbNullString Then
If Cells(a, b) = vbNullString Then
a = a + 1
GoTo line2
Else
If Cells(a, 1) <> vbNullString Then
If Cells(a, b) = doc Then
If Cells(a, b + 1) = num Then
Cells(a, b + 2) = "'" & rev
a = a + 1
GoTo line2
Else
a = a + 1
GoTo line2
End If
Else
a = a + 1
GoTo line2
End If
Else
a = a + 1
GoTo line2
End If
End If
End If
a = 2
b = b + 5
Loop
Application.ScreenUpdating = True
End Sub