+ Reply to Thread
Results 1 to 3 of 3

Replacing data using the cell value not the formula

  1. #1
    Registered User
    Join Date
    08-09-2006
    Posts
    2

    Replacing data using the cell value not the formula

    Hi all,

    I'm trying to replace data in a cell range using the cell's value instead of it using the formula.

    I'm using the following code:-

    ActiveSheet.Range("I:I").Select
    Selection.Replace What:="#N/A", Replacement:="0", LookAt:=xlPart, LookIn:=xlValues, _
    SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
    ReplaceFormat:=False

    However, when I run the macro it errors at this point.

    Basically, I'm trying to remove the dreaded #N/A and replace it with a 0. Is there an easier way of doing this??

    Thanks!

  2. #2
    NickHK
    Guest

    Re: Replacing data using the cell value not the formula

    Why not include it in your formula:
    =If(ISNA(<YourFormula>),0,<YourFormula>)

    NickHK

    "Hunter1978" <[email protected]> wrote
    in message news:[email protected]...
    >
    > Hi all,
    >
    > I'm trying to replace data in a cell range using the cell's value
    > instead of it using the formula.
    >
    > I'm using the following code:-
    >
    > ActiveSheet.Range("I:I").Select
    > Selection.Replace What:="#N/A", Replacement:="0",
    > LookAt:=xlPart, LookIn:=xlValues, _
    > SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False,
    > _
    > ReplaceFormat:=False
    >
    > However, when I run the macro it errors at this point.
    >
    > Basically, I'm trying to remove the dreaded #N/A and replace it with a
    > 0. Is there an easier way of doing this??
    >
    > Thanks!
    >
    >
    > --
    > Hunter1978
    > ------------------------------------------------------------------------
    > Hunter1978's Profile:

    http://www.excelforum.com/member.php...o&userid=37261
    > View this thread: http://www.excelforum.com/showthread...hreadid=569786
    >




  3. #3
    Registered User
    Join Date
    08-09-2006
    Posts
    2
    Hi NickHK,

    Thanks for your answer.

    It seemd to have done the trick!

    Many thanks!

+ 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