Excel表格网

excel怎么自动搜索输入框?

175 2024-01-09 22:44 admin   手机版

试试:

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

顶一下
(0)
0%
踩一下
(0)
0%
相关评论
我要评论
用户名: 验证码:点击我更换图片