I'm trying to test if a cell in a closed external workbook is N/A. In the code below, cell "G5" in the referenced workbook is definitely N/A, but when referencing it using the IsNA function below it returns "Good to go!" when the intention is for it to return "Hay!" in the message box.
Sub TestTest()
'Declaring variables [BD]
Dim sFilePath As String
Dim sFileName As String
Dim sSourceSheet As String
Dim sSourceCell As String
sFileName = "0306-0312 Margin Master.xlsx"
sFilePath = "\\store\GroupDrives\Pricing\_Deli_\Deli Fresh Shift\Margin Master\"
sSourceSheet = "Bakery"
sSourceCell = "G5"
If Application.WorksheetFunction.IsNA("'" & sFilePath & "[" & sFileName & "]" & sSourceSheet & "'!" & _
Range("A1").Range(sSourceCell).Address(, , xlR1C1)) Then
MsgBox "Hay!"
Else
MsgBox "Good to go!"
End If
End Sub