jdgalaway
06-07-2013, 12:59 PM
I wrote the following code to VLookup codes in a worksheet. Currently, I just highlight cells with errors. Instead, I want a selection pop-up box that includes items that are similar to what is in the cell with the error. I hope this makes sense and someone can help me.
Sub Main()
On Error Resume Next
Err.Clear
Dim i As Integer
For i = 2 To 200
Worksheets("MyPortfolio").Cells(7, i).Value = Application.WorksheetFunction.VLookup(Worksheets _
("MyPortfolio").Cells(7, i), Worksheets("sheet1").Range("a2:b1428"), 2, False)
If Err <> 0 Then
GoTo Line1
Resume Next
Else
Resume Next
End If
Next i
Dim x As Integer
For x = 2 To 200
If Not IsNumeric(Worksheets("MyPortfolio").Cells(7, x).Value) Then
Worksheets("MyPortfolio").Cells(7, x).Interior.ColorIndex = 6
End If
Next x
Line1:
End Sub
Sub Main()
On Error Resume Next
Err.Clear
Dim i As Integer
For i = 2 To 200
Worksheets("MyPortfolio").Cells(7, i).Value = Application.WorksheetFunction.VLookup(Worksheets _
("MyPortfolio").Cells(7, i), Worksheets("sheet1").Range("a2:b1428"), 2, False)
If Err <> 0 Then
GoTo Line1
Resume Next
Else
Resume Next
End If
Next i
Dim x As Integer
For x = 2 To 200
If Not IsNumeric(Worksheets("MyPortfolio").Cells(7, x).Value) Then
Worksheets("MyPortfolio").Cells(7, x).Interior.ColorIndex = 6
End If
Next x
Line1:
End Sub