ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   check for "#VALUE!" (https://www.excelbanter.com/excel-programming/297057-check-value.html)

fabalicious[_18_]

check for "#VALUE!"
 
Hi there.

I want to check if a cell's value is "#VALUE!". How can I do this?

If Cells(1, 1).Value = "#VALUE!" Then
...

... doesnt work.

Thanks



--
Message posted from http://www.ExcelForum.com


Bob Flanagan

check for "#VALUE!"
 
You can do it this way:

If ActiveCell.Value = CVErr(xlErrValue) Then
MsgBox "value error"
End If

more general is:

If IsError(ActiveCell.Value) Then
MsgBox "the cell contains an error value"
End If

Bob Flanagan
Macro Systems
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel

"fabalicious " wrote in message
...
Hi there.

I want to check if a cell's value is "#VALUE!". How can I do this?

If Cells(1, 1).Value = "#VALUE!" Then
..

.. doesnt work.

Thanks

F


---
Message posted from http://www.ExcelForum.com/




fabalicious[_19_]

check for "#VALUE!"
 
cheers

--
Message posted from http://www.ExcelForum.com


tinyjack[_4_]

check for "#VALUE!"
 
You can use a combination of IsError and CVErr, something like:


Code
-------------------

If IsError(Cells(1, 1).Value) Then

If Cells(1,1).Value = CVErr(xlErrValue) Then

MsgBox "#Value Error in Cell"

Else

MsgBox "Other Error in Cell"

End If

Else

MsgBox "No Error in Cell"

End If

-------------------


Check the help files for more information.

T

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 04:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com