I have a cell that is a brutal nested if and if error. I don't want to have to paste my vlookup 5 times in the formula. Instead, I'd like to have a macro check the errors. The special case is 0 or 1.
I wrote this function to get the value of the vlookup.
Public Function ValidateRealization(value As String)
Dim validate As String
If value = "#N/A" Or value = "#VALUE!" Or value or = "#REF!" Or value = "#DIV/0!" Or value = "#NUM!" Or value = "#NAME?" Or value = "#NULL!" Or value = "0" Or value = "1" Then
validate = ""
Else
validate = value
End If
ValidateRealization = validate
End Function
However, I know it can be improved for one when I set the value, the formatting as a percentage is overridden.
Is there a better way to do this? Maybe by getting the active cells range, and setting the value property?
ervalue?valuesused to beerror