+ Reply to Thread
Results 1 to 7 of 7

Clearing Cells which yield "#N/A"

  1. #1
    Registered User
    Join Date
    06-01-2013
    Location
    United States
    MS-Off Ver
    Excel 2011
    Posts
    64

    Clearing Cells which yield "#N/A"

    Okay so I basically have a bunch of different cells and some of them yield "#N/A" the actual cell contains the formula "=RANK(AZ13,$AW13:$BI13,0)"

    I have nesting loops to handle this. The first starts at the beginning of a row and checks each cell until it reaches the end of the row, and the next loop tells the program to go to the next row and keep going until all the rows have been checked.

    I have tried telling it to get rid of the cells if the value = "#N/A" (as shown below)
    I have tried to say "IsError(activecell) then..." but I eventually get an error that says "Type Mismatch"
    It gets that error on a cell with formula -- "=RANK(AW29,$AW29:$BI29,0)" and whose value reads "#N/A" -- as far as I can tell it's exactly the same as the other cells which I clears the contents of fine.
    I've also tried telling it to clear the content of the cell if the cell is not a number.
    No luck so far.

    Can anyone offer a tip or even explain why I get a type mismatch error on one cell but not another that is *seemingly* identical?


    Sub eliminatingMISMATCH2()
    Range("BR13").Select

    Do
    Do
    If ActiveCell.Value = "#N/A" Then
    ActiveCell.ClearContents
    ActiveCell.Offset(0, 1).Select
    Else
    ActiveCell.Offset(0, 1).Select
    End If
    Loop Until IsEmpty(ActiveCell)
    ActiveCell.Offset(4, -13).Select

    Loop Until ActiveCell = Range("BR181")

    End Sub

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Clearing Cells which yield "#N/A"

    You need Activecell.text = "#N/A" not activecell.value

  3. #3
    Forum Contributor
    Join Date
    05-29-2013
    Location
    MD
    MS-Off Ver
    Excel 365
    Posts
    148

    Re: Clearing Cells which yield "#N/A"

    Try:

    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Clearing Cells which yield "#N/A"

    Maybe try:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    06-01-2013
    Location
    United States
    MS-Off Ver
    Excel 2011
    Posts
    64

    Re: Clearing Cells which yield "#N/A"

    Thanks for all the suggestions but for some reason that one cell in particular is still giving me the same Type Mismatch error. The strange thing is that if I copy the formula in that cell and put it in another cell (it doesn't reformat the formula to match the destination -- literally the same formula just in a different cell) it doesn't give me a type mismatch error. Clears the contents just fine.

    Any thoughts as to why that might be?

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Clearing Cells which yield "#N/A"

    Please Login or Register  to view this content.

  7. #7
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Clearing Cells which yield "#N/A"

    More likely


    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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