Dim s As String Dim t As Table = Tables("编程参考") Dim i As Integer For i = 0 To t.Rows.Count - 1 If t.Rows(i)("常用网址").Contains("baidu") Then s = t.Rows(i)("常用网址") End If Exit For Next For j As Integer = i To t.Rows.Count - 1 If Len(t.Rows(j)("常用网址")) > Len(s) AndAlso t.Rows(j)("常用网址").Contains("baidu") Then s = t.Rows(j)("常用网址") End If Next MessageBox.Show(s)