- ©«¤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
|
¥»©«³Ì«á¥Ñ GBKEE ©ó 2011-11-16 17:55 ½s¿è
¦^´_ 6# dafa
VBA ¤¤¥[¤Jª«¥óÃþ§O¼Ò²Õ ¦p¹Ï
UserFormªºµ{¦¡½X- Option Explicit
- Dim ButtonClass() As New TheButton
- 'ButtonClassÅܼƳ]©w¬° New TheButtonª«¥óÃþ§O¼Ò²Õ
- Private Sub UserForm_Initialize()
- Dim E As Control, i As Integer
- For Each E In Me.Controls
- If InStr(E.Name, "CommandButton") Then
- i = i + 1
- ReDim Preserve ButtonClass(1 To i)
- Set ButtonClass(i).Button = E '«ü©w TheButton.Button(i) ªºª«¥ó
- End If
- Next
- End Sub
½Æ»s¥N½X ª«¥óÃþ§O¼Ò²Õªºµ{¦¡½X- Option Explicit
- Public WithEvents Button As MSForms.CommandButton
- Private Sub Button_Click()
- Dim A As Integer
- 'UserForm ¤¤ CommandButton.Name ¦WºÙ '¨Ì§Ç¬°CommandButton1,CommandButton2...
- A = Replace(Button.Name, "CommandButton", "")
- '''''''''''©ÎªÌ¦p¦¹¤]¦æ''''''''''''''''''''''''''''''''''''''''''
- 'UserForm ¤¤ CommandButton.Caption ¦bª«¥ó¤Wªº×¹¢¤å¦r '¦p¨Ì§Ç¬° «ö¶s1,«ö¶s2...
- 'A = Replace(Button.Caption, "«ö¶s", "")
- ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- Sheets(1).Cells(A, "A") = Sheets(1).Cells(A, "A") + 1
- End Sub
½Æ»s¥N½X |
|