Bonjour à tous, Forum,
J'ai une question qui va certainement faire sourire les spécialistes VBA mais je n'ai rien trouvé sur le forum (mais j'ai certainement mal cherché...) pour résoudre mon problème.
Je souhaite combiné un test IF avec plusieurs and et j'ai donc écrit la syntaxe suivante :
Sub Solving()
Dim MyProblem As Integer
Dim Micronage As Integer
Dim solution As String
Dim choice As Integer
choice = 0
MyProblem = 0
solution = ""
Micronage = 0
MyProblem = InputBox("Please enter the digit of your Polymer's problem " & vbNewLine & " 1 = Dirt . " & vbNewLine & " 2 = Gels")
If MyProblem = 1 Then
Micronage = InputBox("Please enter the micronage value of the impurity (in µm)")
If Micronage >= Worksheets("Media").Range("J74").Value And Micronage < Worksheets("Media").Range("K74").Value Then
solution = solution & vbNewLine & "SINTERED POWDER"
End If
If Micronage >= Worksheets("Media").Cells(49, 10) And Micronage <= Worksheets("Media").Cells(49, 11) Then
solution = solution & vbNewLine & "Dutch weave"
End If
If Micronage >= Worksheets("Media ").Cells(25, 10) And Micronage <= Worksheets("Media ").Cells(25, 11) Then
solution = solution & vbNewLine & "Multipor"
End If
If Micronage > Worksheets("Media").Cells(63, 10) And Micronage <= Worksheets("Media").Cells(63, 11) Then
solution = solution & vbNewLine & "MICRO-PERFORATED"
End If
If Micronage > 200 Then
solution = solution & vbNewLine & "CLASSICAL WEAVE"
End If
MsgBox "solution"
End If
End sub
Après avoir lancé un débogage , j'ai un message erreur " L'indice n'appartient pas à la selection". Au niveau de la ligne soulignée.
Merci d'avance pour votre aide.