ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ½Ð°Ý¤@­ÓUserForm»PTextBoxªº°ÝÃD

[µo°Ý] ½Ð°Ý¤@­ÓUserForm»PTextBoxªº°ÝÃD

½Ð°Ý§Ú¦³¤@­ÓUserForm¤º¦@¦³83­ÓTextBox
§Ú­n±NUserForm¤º©Ò¦³TextBoxªºLocked¥þ³¡TRUE©Î¬OFALSE
½Ð¦U¦ì°ª¤âÀ°¦£¤@¤UÁÂÁÂ

¥Î·Æ¹«©Ô¥X¤@½d³ò§t»\©Ò¦³ªºTextBox
¦A¥h³]©wÄÝ©Ê

TOP

¦^´_ 2# register313


    ·PÁ¤j¤jªº¼ö¤ß
¥i¯à¬O§Ú»¡ªº¤£°÷¸Ô²Ó
§Úªº·N«ä¬O·í¬Y­Ó±ø¥óº¡¨¬«áUserForm¤ºªºTextBoxªºLOCKED¥þ³¡ÅÜTRUE©ÎFALSE

TOP

¦^´_ 1# dafa
  1. Private Sub UserForm_Initialize()
  2.     Dim E As Control
  3.     For Each E In Me.Controls
  4.         If InStr(E.Name, "TextBox") Then E.Locked = True
  5.     Next
  6. End Sub
½Æ»s¥N½X

TOP

¦^´_ 4# GBKEE

·PÁÂG¤jªº±Ð¾É
¤p§Ì¨ü¯q¨}¦h

TOP

¦^´_ 4# GBKEE


    ·Q¦A½Ð°ÝG¤j¤@­Ó°ÝÃD
¦pªG§Ú¦³100­ÓCommandButton
¨C­ÓCommandButton¹ïÀ³1­ÓÀx¦s®æ
¨Ò¦p«ö¤UCommandButton5«hA5+1
«ö¤UCommandButton10«hA10+1
³o¼Ë§Ú¬O§_µ{¦¡½X­n§ï100¦¸
¦³¨S¦³¤ñ¸û§Öªº¤è¦¡

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2011-11-16 17:55 ½s¿è

¦^´_ 6# dafa
VBA ¤¤¥[¤Jª«¥óÃþ§O¼Ò²Õ ¦p¹Ï






UserFormªºµ{¦¡½X
  1. Option Explicit
  2. Dim ButtonClass() As New TheButton
  3. 'ButtonClassÅܼƳ]©w¬° New TheButtonª«¥óÃþ§O¼Ò²Õ
  4. Private Sub UserForm_Initialize()
  5.     Dim E As Control, i As Integer
  6.     For Each E In Me.Controls
  7.         If InStr(E.Name, "CommandButton") Then
  8.             i = i + 1
  9.             ReDim Preserve ButtonClass(1 To i)
  10.             Set ButtonClass(i).Button = E     '«ü©w TheButton.Button(i) ªºª«¥ó
  11.         End If
  12.     Next
  13. End Sub
½Æ»s¥N½X
ª«¥óÃþ§O¼Ò²Õªºµ{¦¡½X
  1. Option Explicit
  2. Public WithEvents Button As MSForms.CommandButton
  3. Private Sub Button_Click()
  4.     Dim A As Integer
  5.     'UserForm ¤¤  CommandButton.Name                ¦WºÙ      '¨Ì§Ç¬°CommandButton1,CommandButton2...
  6.     A = Replace(Button.Name, "CommandButton", "")
  7.     '''''''''''©ÎªÌ¦p¦¹¤]¦æ''''''''''''''''''''''''''''''''''''''''''
  8.     'UserForm ¤¤  CommandButton.Caption ¦bª«¥ó¤Wªº­×¹¢¤å¦r  '¦p¨Ì§Ç¬° «ö¶s1,«ö¶s2...
  9.     'A = Replace(Button.Caption, "«ö¶s", "")
  10.     ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  11.     Sheets(1).Cells(A, "A") = Sheets(1).Cells(A, "A") + 1

  12. End Sub
½Æ»s¥N½X

TOP

¦^´_ 7# GBKEE


    ·PÁÂG¤j
·Pı¦³¤@ÂI¦³¬Ý¨S¦³À´
«Ý§Ú»{¯u¬ã¨s..®ø¤Æ¤@¤U
¦A¨Ó½Ð±Ð

TOP

¦^´_ 7# GBKEE


    ½Ð°ÝG¤j

ReDim Preserve ButtonClass(1 To i)
³o¤@¥¨¥i§_Á¿¸Ñ¤@¤U
ÁÂÁÂ

TOP

¦^´_ 9# dafa
ReDim Preserve °}¦C( 1 To i )    ­«·s°t¸m°ÊºA°}¦CÅÜ¼Æ ªººû¼Æ ¤´µM«O¦³­ì¨Óªº¸ê®ÆªºÃöÁä¦r

ReDim ³¯­z¦¡:  ¦bµ{§Ç¼h¦¸¤¤¥Î¨Ó­«·s°t¸m°ÊºA°}¦CÅܼƪºÀx¦sªÅ¶¡
Preserve ¿ï¾Ü©Ê¤Þ¼Æ¡C·í§ïÅܭ즳°}¦C³Ì«á¤@ºûªº¤j¤p®É¡A¤´µM«O¦³­ì¨Óªº¸ê®ÆªºÃöÁä¦r¡C

TOP

        ÀR«ä¦Û¦b : ¡i¬O§_µo´§¤F¨}¯à¡H¡j¤H¶¡¹Ø©R¦]¬°µu¼È¡A¤~§óÅã±o¬Ã¶Q¡CÃø±o¨Ó¤@½ë¤H¶¡¡AÀ³°Ý¬O§_¬°¤H¶¡µo´§¤F¦Û¤vªº¨}¯à¡A¦Ó¤£­n¤@¨ý¨Dªø¹Ø¡C
ªð¦^¦Cªí ¤W¤@¥DÃD