|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- 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
复制代码 |
|