Probleme MAcro avec condition

Bonjour,

J'ai cette macro qui fonctionne très bien.

J'ai voulu ajouter une action en plus avec une condition IF / ELSE

Partie de la macro concernée :

If Range("BZ4").Value = "SB" Then Application.Run "POSITIONclickSMALLBLIND"

Else: Call POSITIONclickBIGBLIND

Voic la macro :

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Valeur As String, Plage As Range

If Not Intersect(Target, [C11:O23]) Is Nothing And Target.Count = 1 Then

    If Range("BZ4").Value = "SB" Then Application.Run "POSITIONclickSMALLBLIND"
    Else: Call POSITIONclickBIGBLIND

   [CC4] = Target.Value
   [C11:O23].Interior.COLOR = RGB(255, 255, 255)
   With Target
      .Interior.COLOR = RGB(252, 228, 214)
      With .Borders
        [C11:O23].Borders.LineStyle = xlContinuous
        .LineStyle = xlContinuous
        .Weight = xlMedium
     End With
   End With
End If
End Sub

Pourriez vous m'aider à la modifier pour qu'elle fonctionne avec cette nouvelle action si condition ?

merci

Bonjour,

Si tu rajoutes une condition (If) ne pas oublier le End If

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Valeur As String, Plage As Range

If Not Intersect(Target, [C11:O23]) Is Nothing And Target.Count = 1 Then

    If Range("BZ4").Value = "SB" Then 
        Application.Run "POSITIONclickSMALLBLIND"
    Else
        Call POSITIONclickBIGBLIND
   End If

   [CC4] = Target.Value
   [C11:O23].Interior.COLOR = RGB(255, 255, 255)
   With Target
      .Interior.COLOR = RGB(252, 228, 214)
      With .Borders
        [C11:O23].Borders.LineStyle = xlContinuous
        .LineStyle = xlContinuous
        .Weight = xlMedium
     End With
   End With
End If
End Sub
Rechercher des sujets similaires à "probleme macro condition"