Home » excel » excel – Range("").Value = "Percentage%" Error

excel – Range("").Value = "Percentage%" Error

Posted by: admin April 23, 2020 Leave a comment


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
 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.

How to&Answers:

A percentage is a number formatted like text.


Range("D5").Value = "100%" 

to its decimal value.

Range("D5").Value = 1