- ©«¤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
|
¦^´_ 6# ayubbs
UserForm2- Option Explicit
- Dim Rng As Range
- Private Sub UserForm_Initialize()
- Set Rng = ThisWorkbook.Worksheets("Sheet1").Range("A1")
- With ComboBox1 '
- .Value = ""
- .ColumnCount = 1
- If Rng <> "" Then
- .List = Rng.CurrentRegion.Value
- .Value = Rng
- Else
- .Clear
- End If
- End With
- End Sub
- Private Sub ComboBox1_Change()
- Dim AR, i As Integer
- AR = Array(TextBox1, TextBox2, TextBox3)
- With ComboBox1
- If .ListIndex > -1 Then
- For i = 0 To UBound(AR)
- AR(i).Value = .List(.ListIndex, i + 1)
- Next
- '¤@°ïªºªº±±¨î¶µ¼g¤£§¹
- ' TextBox1 = .List(.ListIndex, 1)
- ' TextBox2 = .List(.ListIndex, 2)
- ' TextBox3 = .List(.ListIndex, 3)
- End If
- End With
- End Sub
- Private Sub CommandButton1_Click() '§R°£¿ï¾Ü¦C
- With ComboBox1
- If .ListIndex > -1 Then
- If MsgBox("§R°£¿ï¾Ü¦C" & .Value, vbYesNo) = vbYes Then
- Rng.CurrentRegion.Rows(.ListIndex + 1).Delete
- Set Rng = ThisWorkbook.Worksheets("Sheet1").Range("A1")
- If Rng <> "" Then
- .List = Rng.CurrentRegion.Value
- Else
- .Clear
- End If
- End If
- Else
- MsgBox "¸ê®Æ®w ¨S¦³ " & .Value, , "§R°£¿ï¾Ü¦C"
- End If
- End With
- End Sub
- Private Sub CommandButton2_Click() '·s¼W¤@¦C
- Dim AR
- AR = Array(ComboBox1, TextBox1, TextBox2, TextBox3)
- With ComboBox1
- If .ListIndex > -1 Then
- MsgBox "¸ê®Æ®w¤¤¤w¦³ " & .Value, , "·s¼W¤@¦C"
- ElseIf .ListIndex = -1 Then
- If InStr("," & Join(AR, ",") & ",", ",,") Then
- MsgBox "¸ê®Æ¤£¥þ"
- ElseIf MsgBox("·s¼W¤@¦C " & .Value, vbYesNo) = vbYes Then
- If Rng = "" Then
- Rng.Resize(, UBound(AR) + 1).Value = AR
- Else
- With Rng.CurrentRegion
- .Cells(.Rows.Count + 1, 1).Resize(, UBound(AR) + 1) = AR
- End With
- End If
- .List = Rng.CurrentRegion.Value
- End If
- End If
- End With
- End Sub
- Private Sub CommandButton3_Click() 'קïÀx¦s
- Dim Ar1, Ar2
- With ComboBox1
- If .ListIndex > -1 Then
- Ar1 = Array(ComboBox1, TextBox1, TextBox2, TextBox3)
- Ar2 = Application.Transpose(Application.Transpose(Rng.CurrentRegion.Rows(.ListIndex + 1)))
- If InStr("," & Join(Ar1, ",") & ",", ",,") Then
- MsgBox "¸ê®Æ¤£¥þ !!"
- ElseIf Join(Ar1, ",") = Join(Ar2, ",") Then
- MsgBox Join(Ar1, ",") & vbLf & "¸ê®Æ¨S¦³×§ï!!"
- ElseIf MsgBox("קïÀx¦s " & vbLf & Join(Ar1, ","), vbYesNo) = vbYes Then
- Rng.CurrentRegion.Rows(.ListIndex + 1).Resize(, UBound(Ar1) + 1) = Ar1
- .List = Rng.CurrentRegion.Value
- End If
- ElseIf .ListIndex = -1 Then
- MsgBox "½Ð¿ï¾Ü ·s¼W¤@¦C «öÁä", , "קïÀx¦s"
- End If
- End With
- End Sub
½Æ»s¥N½X |
|