Another Option...
Sub J3v16()
Dim Data, Arr
With Cells(1).CurrentRegion
Data = Filter(.Parent.Evaluate("Transpose(If(" & .Columns(2).Address & "=0,row(1:" & .Rows.Count & ")))"), False, 0)
If UBound(Data) > -1 Then
Arr = Application.Index(.Value, Application.Transpose(Data), 1)
MsgBox "MISSING DATA FOR THE FOLLOWING VALUES - " & Join(WorksheetFunction.Transpose(Arr), ",")
Else
MsgBox "NO MISSING DATA", vbInformation, ""
End If
End With
End Sub
Or, if you want to loop...
Sub J3v16()
Dim Data, Arr, i As Long, x As Long
Data = Cells(1).CurrentRegion.Value
ReDim Arr(1 To UBound(Data))
For i = 2 To UBound(Data)
If Data(i, 2) = 0 Then x = x + 1: Arr(x) = Data(i, 1)
Next i
If x > 0 Then
ReDim Preserve Arr(1 To x)
MsgBox "MISSING DATA FOR THE FOLLOWING VALUES - " & Join(Arr, ",")
Else
MsgBox "NO MISSING DATA", vbInformation, ""
End If
End Sub
Bookmarks