Excel VBA - .Value

Résolu
nine -  
 nine -
Bonjour,

je voudrais que le N/A soit effacé et que la macro permette à l'utilisateur d'entrer la valeur qu'il souhaite "à la main".

Private Sub Worksheet_Change(ByVal Target As Range)
Dim num As Integer
Application.ScreenUpdating = False
Application.EnableEvents = False
ActiveSheet.Unprotect Password:="BE"
If Range("C4").Value = "R&D only" Then
Range("F11").Value = "N/A"
Range("B11:h11").Interior.Color = RGB(165, 165, 165)
Range("F11").Font.ColorIndex = 2
End If
If Range("C4").Value <> "R&D only" Then
Range("F11").Value = ?
Range("B11:e11").Interior.Color = RGB(219, 229, 241)
Range("f11:H11").Interior.Color = RGB(255, 255, 255)
End If
ActiveSheet.Protect Password:="BE"
Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub
Configuration: Windows XP
Safari 532.0

1 réponse

  1. nine
     
    OK c'est bon j'ai trouvé

    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim num As Integer
    Application.ScreenUpdating = False
    Application.EnableEvents = False
    ActiveSheet.Unprotect Password:="BE"
    If Range("C4").Value = "R&D only" Then
    Range("F11").Value = "N/A"
    Range("B11:h11").Interior.Color = RGB(165, 165, 165)
    Range("F11").Font.ColorIndex = 2
    End If
    If Range("C4").Value <> "R&D only" Then
    If Range("F11").Value = "N/A" Then
    Range("F11").Value = ""
    Range("B11:e11").Interior.Color = RGB(219, 229, 241)
    Range("f11:H11").Interior.Color = RGB(255, 255, 255)
    End If
    End If
    ActiveSheet.Protect Password:="BE"
    Application.ScreenUpdating = True
    Application.EnableEvents = True
    End Sub
    0