Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default How to check whether cell has #REF ! error?

Dear Friends,

I want to check whether cell has #REF ! error? I am trying to get the
values of a cell range. If any cell has an error "#REF!" then
"ActiveCell.value" fails. Whats a way to check whether cell has an
error so I can consider any default value for that cell.

Regards,

Vinit

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default How to check whether cell has #REF ! error?

Hi Vinit,

Try something like:


'======================
Sub Tester()

Dim rng As Range
Dim rcell As Range

Set rng = Range("A1:A50")

For Each rcell In rng.Cells
If IsError(rcell.Value) Then
If rcell.Value = CVErr(2023) Then
'do something, e.g.:
MsgBox "Error"
End If
End If
Next

End Sub

'<<======================

---
Regards,
Norman



"Vinit" wrote in message
ups.com...
Dear Friends,

I want to check whether cell has #REF ! error? I am trying to get the
values of a cell range. If any cell has an error "#REF!" then
"ActiveCell.value" fails. Whats a way to check whether cell has an
error so I can consider any default value for that cell.

Regards,

Vinit



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default How to check whether cell has #REF ! error?

Thanks Norman,
I solved it using a similar soltion.

If(Application.IsError(ActiveCell.Value))Then
MsgBox " Cell contains error handle it"
Else
MsgBox " Cell does not contain error"
EndIf

Regards,

Vinit

Norman Jones wrote:
Hi Vinit,

Try something like:


'======================
Sub Tester()

Dim rng As Range
Dim rcell As Range

Set rng = Range("A1:A50")

For Each rcell In rng.Cells
If IsError(rcell.Value) Then
If rcell.Value = CVErr(2023) Then
'do something, e.g.:
MsgBox "Error"
End If
End If
Next

End Sub

'<<======================

---
Regards,
Norman



"Vinit" wrote in message
ups.com...
Dear Friends,

I want to check whether cell has #REF ! error? I am trying to get the
values of a cell range. If any cell has an error "#REF!" then
"ActiveCell.value" fails. Whats a way to check whether cell has an
error so I can consider any default value for that cell.

Regards,

Vinit


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
check or uncheck a check box based on a cell value RTKCPA Excel Discussion (Misc queries) 1 February 3rd 10 03:11 PM
Copy and move check box (check boxes) with new cell link? Marty Excel Worksheet Functions 1 January 20th 10 07:43 PM
Check for error.type in same cell art Excel Worksheet Functions 2 May 13th 09 06:14 AM
Color cell if spell check finds an error LiveUser Excel Worksheet Functions 3 January 15th 08 08:50 PM
Check if Conditional Format is True or False / Check cell Color Kevin McCartney Excel Worksheet Functions 5 June 29th 07 11:12 AM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"