|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Public Function GetBianHao(ByVal MingCheng As String, ByVal DiFang As String, ByVal DATEX As Date) As String
- Application.Volatile
- Dim SHX As Worksheet
- Set SHX = Worksheets("数据")
- INTCC = 20000
- StrBH = ""
- For IROW = 2 To SHX.Range("A65536").End(3).Row
- If SHX.Cells(IROW, 1).Value = MingCheng And SHX.Cells(IROW, 2).Value = DiFang Then
- INTDT = DateDiff("D", SHX.Cells(IROW, 3).Value, DATEX)
- If INTDT > 0 Then '//在此之前
- If INTCC > INTDT Then
- INTCC = INTDT
- StrBH = SHX.Cells(IROW, 4).Value
- End If
- End If
- End If
- Next
- GetBianHao = StrBH
- End Function
复制代码 |
|