- ©«¤l
- 5923
- ¥DÃD
- 13
- ºëµØ
- 1
- ¿n¤À
- 5986
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW°ò¶©
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2022-1-23
        
|
¦^´_ 2# luhpro
¥t¤@¼gªk
UserForm¼Ò²Õ- Option Explicit
- Dim D As Object
- Private Sub UserForm_Initialize()
- txt½s¸¹ = ½s¸¹
- End Sub
- Private Sub cb¿é¤J_Click()
- With Sheets("¤u§@ªí1")
- If Application.CountIf(.Range("a:a"), txt½s¸¹) > 0 And txt½s¸¹ <> "" Then
- MsgBox "½s¸¹¤w¦s¦b!", vbCritical, "¿ù»~"
- Exit Sub
- ElseIf UBound(Split(txt½s¸¹, "-")) = 0 Or txt½s¸¹ = "" Then
- MsgBox "½s¸¹ ®æ¦¡ ¿ù»~!", vbCritical, "¿ù»~"
- Exit Sub
- ElseIf UCase(txt½s¸¹) <> "AL-" & Format(Application.Max(D.KEYS) + 1, "000") Then
- MsgBox txt½s¸¹ & " »Ý¬O " & "AL-" & Format(Application.Max(D.KEYS) + 1, "000"), vbCritical, "¿ù»~"
- Exit Sub
- End If
- .Range("A65536").End(xlUp).Cells(2) = txt½s¸¹
- D(Application.Max(D.KEYS) + 1) = ""
- End With
- End Sub
- Private Sub CommandButton2_Click() 'cb¿é¤J«á,¥iÄ~Äò + 1
- txt½s¸¹ = "AL-" & Format(Application.Max(D.KEYS) + 1, "000")
- End Sub
- Private Function ½s¸¹() As String
- Dim E As Range
- Set D = CreateObject("SCRIPTING.DICTIONARY")
- For Each E In ¤u§@ªí1.Range("A:A").SpecialCells(xlCellTypeConstants)
- If UBound(Split(E, "-")) > 0 Then D(Val(Split(E, "-")(1))) = ""
- Next
- If D.Count = 0 Then
- ½s¸¹ = "AL-001"
- D(0) = ""
- Else
- ½s¸¹ = "AL-" & Format(Application.Max(D.KEYS) + 1, "000")
- End If
- End Function
½Æ»s¥N½X |
|