VBA clear cell content if it contains...

Solved
kealvin Posted messages 10 Registration date   Status Member Last intervention   -  
kealvin Posted messages 10 Registration date   Status Member Last intervention   -
Bonjour,
What would be the code to clear the content of a cell if it contains the letter A?

Best regards

4 answers

  1. Patrice33740 Posted messages 8400 Registration date   Status Member Last intervention   1 784
     
    Hello,

    Example:
    Option Explicit Sub Test() Dim c As Range ' define the concerned cell Set c = Worksheets("Sheet1").Range("B12") ' test the content If c.Value = "A" Then ' clear its content c.ClearContents End If End Sub

    Best regards
    Patrice
    0