前边加上两句话是不是更好,中间再改一句话,这样选中不同的IP地址都可以实现需要的功能。
Dim s as String
s = Tables("设备一览表").Current("ip地址")
MainTable = Tables("ip表")
With CurrentTable
Dim r As Integer
’r = .Find("192.168.1.5", 0, 0, False, False, True)
r = .Find(s, 0, "ip地址", False, False, True)
If r > - 1 Then '如果找到符合条件的行
.Position = r '则选择该行
End If
End With