I am looking for a simple line of VBA that erases certain cells when other cells equals a certain value.
The following code works great with Text and Numeric value, but it fails to check and clear the cells if the value equals a percentage.
Sub Module1()
If Range("C5").Value Like "Done" And Range("D5").Value = "100%" Then
Range("B5").ClearContents
End If
End Sub
It still doesn't work if I remove the % sign from the D5 Value checkup. The cell itself is Formatted as a Percentage.
A percentage is a number formatted like text.
Change
Range("D5").Value = "100%"
to its decimal value.
Range("D5").Value = 1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With