Sub test() ‘按钮 1
On Error Resume Next
tmp = “找不到需要的供应商”
GYS = InputBox(“请输入: 供应商名称”)
If GYS = “” Then Exit Sub
[F3:g3].ClearContents ‘清空原先结果(根据需要修改)可避免查此
Set p = Cells.Find(What:=GYS, LookIn:=xlValues, LookAt:=xlWhole)
If p Is Nothing Then MsgBox tmp: Exit Sub
Rw = p.Row
Col = p.Column
n = Cells(65536, Col).End(xlUp).Row
For i = Rw To n
If Cells(i, Col) = GYS And Cells(i, Col + 1) – x > 0 Then x = Cells(i, Col + 1)
Next
If x = 0 Then MsgBox tmp: Exit Sub
t = Format(x, “yyyy-m-d”)
MsgBox “供应商:” & GYS & ” // 最后送样日期:” & t & Space(10), 64, ” Lwu.提示:”
[F3] = GYS: [g3] = t ‘写入单元格(根据需要修改)
End Sub
如果觉得《EXCEL中如何实现点击按钮自动弹出输入框 输入后按要求进行自动搜索? – 网络》对你有帮助,请点赞、收藏,并留下你的观点哦!