Consulting

Results 1 to 5 of 5

Thread: Reference #N/A

  1. #1
    VBAX Regular
    Joined
    Oct 2012
    Posts
    85
    Location

    Reference #N/A

    A formula is used in cell G2. If the formula doesnt work, the cell has #N/A N/A

    Is there a way to reference those cells in which I get an #N/A N/A?

  2. #2
    VBAX Expert
    Joined
    Aug 2004
    Posts
    810
    Location
    try using
    [VBA]
    IsError()
    [/VBA]

  3. #3
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Not clear if you want VBA or Worksheet reference
    =IF(ISNA(H8),"Error","")
    [VBA]If Application.IsNA([H8]) Then MsgBox "Error"
    [/VBA]
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  4. #4
    VBAX Regular
    Joined
    Oct 2012
    Posts
    85
    Location
    [VBA]Sub PriceFormula()
    Dim NumBlocks As Long
    Dim Lastrow As Long
    Dim i As Long
    With ActiveSheet

    Lastrow = .Cells(.Rows.Count, "F").End(xlUp).Row
    For i = 3 To Lastrow

    If .Cells(i, "G").Value = "IsError()" Then

    .Cells(i, "G").Formula = _
    "=BDH(RC[-5]&"" equity"",""px_last"")"

    End If

    Next i

    End With
    End Sub

    [/VBA]

    I am trying to say if the cells in column G have an error, then enter the formula above..

  5. #5
    VBAX Expert
    Joined
    Aug 2004
    Posts
    810
    Location
    Try this
    [VBA]
    Sub PriceFormula()
    Dim NumBlocks As Long
    Dim Lastrow As Long
    Dim i As Long
    With ActiveSheet

    Lastrow = .Cells(.Rows.Count, "F").End(xlUp).Row
    For i = 3 To Lastrow
    If Application.IsNA(.Cells(i, "G").Value) Then
    .Cells(i, "G").Formula = _
    "=BDH(RC[-5]&"" equity"",""px_last"")"
    End If

    Next i

    End With
    End Sub
    [/VBA]

Posting Permissions

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