- ©«¤l
- 1447
- ¥DÃD
- 40
- ºëµØ
- 0
- ¿n¤À
- 1471
- ÂI¦W
- 0
- §@·~¨t²Î
- Windows 7
- ³nÅ骩¥»
- Excel 2010 & 2016
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2020-7-15
- ³Ì«áµn¿ý
- 2024-12-5
|
¦^´_ 3# gaishutsusuru
ÁÂÁ½׾Â,ÁÂÁ«e½ú¦^´_
¤½¦¡«ÜÃø,«á¾ÇÁÙ¨S¨ºÓ¥\¤O³]p,¥H¤U¬O±N#2¼Ó§ï¦¨¦Ûq¨ç¼Æªº¾Ç²ß¤è®×,½Ð«e½ú°Ñ¦Ò
¨Ï¥Î¤è¦¡»Pµ²ªG:
Option Explicit
Function GetSerial(ST$)
Dim Brr, Z$, X, Q, K$, V0$, V1$, T0$, T1$, i&, M%, Y%
Dim D As Date, P As Date, P1 As Date
Brr = Range([A1], Cells(Rows.Count, 1).End(3))
T0 = ST: V0 = Mid(T0, InStr(T0, "_") + 1)
Y = Left(Val(T0), 4): M = Val(Right(Val(T0), 2))
D = CDate(Y & "/" & M & "/01")
For i = 1 To UBound(Brr)
T1 = Brr(i, 1): V1 = Mid(T1, InStr(T1, "_") + 1)
Y = Left(Val(T1), 4): M = Val(Right(Val(T1), 2))
Y = Y + M \ 12: M = M Mod 12 + 1
P = CDate(Y & "/" & M & "/01") - 1
If (T0 = T1) + (V0 <> V1) + (P > D) Then GoTo i01
If P1 - Date < P - Date Then
P1 = P: Z = Format(P1, "YYYYMM") & "_" & V0
End If
i01: Next
GetSerial = IIf(Z <> "", Z, "µL")
Erase Brr
End Function |
|