Results 1 to 3 of 3

Question about Error 2023 code.

This is a discussion on Question about Error 2023 code. within the Excel Questions forums, part of the Question Forums category; Code: Do If ActiveCell.Value = ActiveCell.Offset(2, 0).Value Then ActiveCell.Offset(-1, -1).Interior.ColorIndex = 4 ActiveCell.Offset(5, 0).Select Else ActiveCell.Offset(5, 0).Select End If Loop ...

  1. #1
    Board Regular
    Join Date
    Mar 2007
    Posts
    581

    Default Question about Error 2023 code.

    Code:
     
    Do
        If ActiveCell.Value = ActiveCell.Offset(2, 0).Value Then
            ActiveCell.Offset(-1, -1).Interior.ColorIndex = 4
            ActiveCell.Offset(5, 0).Select
        Else
            ActiveCell.Offset(5, 0).Select
        End If
    Loop Until ActiveCell.Offset(2, 0).Value = "#REF!"
    If ActiveCell.Offset(2, 0).Value = "#REF!", then I get an error.

    Anyway to make more robust? When I hover over the above statement (ActiveCell.Offset(2, 0).Value), I get an Error 2023 message as a tool tip.

    I want the loop to stop if it encounters a "#REF!" statement in the cell as a result of a formula.
    TIA!

  2. #2
    Board Regular iggydarsa's Avatar
    Join Date
    Jun 2005
    Location
    One of the Blue States
    Posts
    1,535

    Default Re: Question about Error 2023 code.

    try this

    Code:
    Loop Until IsError(ActiveCell.Offset(2, 0).Value)
    instead of
    Code:
    Loop Until ActiveCell.Offset(2, 0).Value = "#REF!"

  3. #3
    Board Regular
    Join Date
    Mar 2007
    Posts
    581

    Default Re: Question about Error 2023 code.

    Thanks.. I tried IsError, just had it in the wrong place.

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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


DMCA.com