+ Reply to Thread
Results 1 to 3 of 3

How to check whether cell has #REF ! error?

  1. #1
    Vinit
    Guest

    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. #2
    Norman Jones
    Guest

    Re: 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" <[email protected]> wrote in message
    news:[email protected]...
    > 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. #3
    Vinit
    Guest

    Re: 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" <[email protected]> wrote in message
    > news:[email protected]...
    > > 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1