View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Nigel[_2_] Nigel[_2_] is offline
external usenet poster
 
Posts: 735
Default search column for data

Test for any errors in column B using (set references as required).....

Sub ErrorsInColumn()
Dim myRng As Range, myCell As Range, mySht As Worksheet

Set mySht = Sheets("Sheet1")

With mySht
Set myRng = .Range(.Cells(1, 2), .Cells(.Cells(.Rows.Count,
2).End(xlUp).Row, 2))
For Each myCell In myRng
If IsError(myCell.Value) Then MsgBox "Error in Column B"
Next myCell
End With

End Sub

--

Regards,
Nigel




"Daniel M" wrote in message
...
I have a macro that has a vlookup formula from a linked spreadsheet. After
calculation i paste special values. If the data is not found it puts a
#N/A
in column B of my spreadsheet. I want to search column B for value #N/A
and
if i find any instances, jump out of the macro and throw up a message box.
can someone help me with this? Also i do not know how long column B will
be.
so i should probably start at the last cell in column B that contains
data.
Thanks.