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

[µo°Ý] ½Ð±Ð Ãö©ó µ{¦¡¶}ÀY ªº¬ÛÃöºÃ´b(©Ó±µ CheckBox ®Ö¿ï°ÝÃD)

[µo°Ý] ½Ð±Ð Ãö©ó µ{¦¡¶}ÀY ªº¬ÛÃöºÃ´b(©Ó±µ CheckBox ®Ö¿ï°ÝÃD)

·Q½Ð°Ý
¤@¯ë¦Ó¨¥
Private Sub UserForm_Initialize()
End Sub
¬° ªì©lª¬ºAªº®É­Ôªºª¬ºA~
©Î

Private Sub CommandButton1_Click()
End Sub

¦ý¦pªG¤µ¤Ñ¬O·Q¥H
Controls("Checkbox" & gosj) ¬°½d³ò
¥Hªí³æ¦Û°Ê§PÂ_¦Ó¤£¥Î CommandButton ¼Ò¦¡¤U

¸Ó«ç±±¨î¤°»ò¤ñ¸û¾A¦X??
µ{¦¡¦p¤U

'¥Dµ{¦¡°Ï¶ô
  1. Private Sub CommandButton1_Click()


  2.     Dim mycheckbox1 As MSForms.CheckBox
  3.           Columns("a:c").Clear
  4.           Columns("a:c").Select
  5.     For kk = 1 To 100

  6.         Cells(kk, 1) = "¤ý" & kk
  7.          
  8.     Next kk

  9.      aois = ActiveSheet.Range("c1").CurrentRegion.Rows.Count

  10.         Selection.ColumnWidth = 15

  11.    
  12.         For sjy = 1 To 450 Step 45


  13.             For sja = 1 To 900 Step 90

  14.                 Set mycheckbox1 = UserForm1.Frame1.Controls.Add("forms.checkbox.1")

  15.                 With mycheckbox1

  16.                     .Left = 10 + sja

  17.                     .Top = 10 + sjy

  18.                     .Width = 70

  19.                     .Height = 20

  20.                     .TextAlign = fmTextAlignCenter

  21.                     .BackColor = &HFFFFC0

  22.                     .Caption = .Name

  23.                 End With

  24.             Next

  25.         Next

  26.     Dim ct As Control

  27.     r = 1

  28.     For Each ct In Controls

  29.     If TypeName(ct.Object) = "ICheckboxControl" Then ct.Caption = Cells(r, 1): Cells(r, 2) = ct.Name

  30.         Cells(r, 3) = ct.Name: r = r + 1

  31.     Next
  32.       aois = ActiveSheet.Range("c1").CurrentRegion.Rows.Count
  33.     For hh = 1 To aois

  34.         For kh = 1 To aois

  35.             If Cells(hh, 3) <> "" Then

  36.                 If Mid(Cells(hh, 3), 1, 8) <> "CheckBox" Then

  37.                     Range("c" & hh).Select

  38.                     Selection.Delete Shift:=xlUp

  39.                
  40.                 End If

  41.             End If

  42.         Next

  43.     Next
  44.      
  45.     Cells(1, 3).Select

  46. End Sub
½Æ»s¥N½X
'»Ý§PÂ_°Ï¶ô
  1. Private Sub CommandButton2_Click()
  2.      Dim mycheckbox1 As MSForms.CheckBox
  3.      aois = ActiveSheet.Range("c1").CurrentRegion.Rows.Count
  4.      For gosj = 1 To aois
  5.         With Controls("Checkbox" & gosj)
  6.             If .Value = True Then
  7.                 Label1.Caption = "²{¦b®Ö¿ï¡G" & .Name
  8.             End If
  9.         End With
  10.      Next

  11. End Sub
½Æ»s¥N½X
¦³¸ÕÅç¹L

Private Sub UserForm_Activate()

End Sub

¦¹¤è¦¡ ¦ýµL¤Ï¬M

  ¦h°µ¦h·Q¦h¾Ç²ß¡A¤Ö¬Ý¤Ö¿ù¤Ö°g³~

  ¦h°µ=¦h¦h½m²ß¡A¦h¦h½s¼g¡C
  ¦h·Q=·Q·Q¬°¤°»ò¤H®aµ{¦¡­n¨º¼Ë¼g¡A¦pªG´«¦¨¦Û¤v¡A¤S·|«ç¼g¡C
  ¦h¾Ç²ß=¾Ç²ß¤H®aªºµo°Ý¨Ã¸Ñµª¡A¾Ç²ß¤H®aªº¼gªk

  ¤Ö¬Ý=¥u¬Ý¤£°µ¤]ªPµM

¦^´_ 13# GBKEE


    ´ú¸Õ¦¨¥\
·PÁ¤j¤j~
©êºp ¤p§Ì¸ê½è·M¬N~

  ¦h°µ¦h·Q¦h¾Ç²ß¡A¤Ö¬Ý¤Ö¿ù¤Ö°g³~

  ¦h°µ=¦h¦h½m²ß¡A¦h¦h½s¼g¡C
  ¦h·Q=·Q·Q¬°¤°»ò¤H®aµ{¦¡­n¨º¼Ë¼g¡A¦pªG´«¦¨¦Û¤v¡A¤S·|«ç¼g¡C
  ¦h¾Ç²ß=¾Ç²ß¤H®aªºµo°Ý¨Ã¸Ñµª¡A¾Ç²ß¤H®aªº¼gªk

  ¤Ö¬Ý=¥u¬Ý¤£°µ¤]ªPµM

TOP

¦^´_ 12# mark15jill
¨£¯º¤F 2010 ©|¥¼ºN¹L
2003 ¦p¹Ï


TOP

¤j¤j±z¦n
¤p§Ìªºª©¥»2010 ¦ü¥G·|¦³¨Ç°ÝÃD²£¥Í~(¦p CLASS)

  ¦h°µ¦h·Q¦h¾Ç²ß¡A¤Ö¬Ý¤Ö¿ù¤Ö°g³~

  ¦h°µ=¦h¦h½m²ß¡A¦h¦h½s¼g¡C
  ¦h·Q=·Q·Q¬°¤°»ò¤H®aµ{¦¡­n¨º¼Ë¼g¡A¦pªG´«¦¨¦Û¤v¡A¤S·|«ç¼g¡C
  ¦h¾Ç²ß=¾Ç²ß¤H®aªºµo°Ý¨Ã¸Ñµª¡A¾Ç²ß¤H®aªº¼gªk

  ¤Ö¬Ý=¥u¬Ý¤£°µ¤]ªPµM

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2012-10-19 12:13 ½s¿è

¦^´_ 9# mark15jill
CommandButton2 §ï¬°UserForm_Click (UserForm_Active ¥u¦³ªí³æÅã¥Ü®É¤~¦³ªº  )   ±NLabel1.Caption  Åã¥Ü¥Ø«e®Ö¿ï¤§Checkbox ªº  
¥i¤]¬O¥i¥H ±ø¥ó¬O¤w¦³²£¥Í 10*10 ­Ó Checkbox±±¨î¶µ

ÂI¿ï¥ô¤@ Checkbox ¡A²£¥Í®ÄªG¦p¦P­ì©l CommandButton2 ¤§®ÄªG¬Û¦P
2#  ¨Ï¥Îª«¥óÃþ§O  2# Private Sub CommandButton1_Click() ¦WºÙ §ï¦¨
Private Sub UserForm_Activate()  ©Î¬O Private Sub UserForm_Initialize()  ¬Ò¥i¥H
  1. 'VBA´¡¤J ª«¥óÃþ§O¼Ò²Õ ¦Û°Ê©R¦W¬°Class1 ªºµ{¦¡½X
  2. Option Explicit
  3. Public WithEvents xlCheckbox As MSForms.Checkbox
  4. Private Sub xlcheckbox_Click()
  5.     '    If xlCheckbox = True Then UserForm1.Label1.Caption = "²{¦b®Ö¿ï¡G" & xlCheckbox.Name
  6.     ½Æ¿ï
  7. End Sub
  8. Private Sub ½Æ¿ï()
  9.     Dim xlCcaptionas As String, E As MSForms.Control
  10.     With UserForm1
  11.         For Each E In .Controls
  12.             If InStr(UCase(E.Name), UCase("checkbox")) Then
  13.                 If E.Value = True Then xlCcaptionas = IIf(xlCcaptionas = "", E.Name, xlCcaptionas & "," & E.Name)
  14.             End If
  15.         Next
  16.         If xlCcaptionas <> "" Then
  17.             .Label1.Caption = "²{¦b®Ö¿ï¡G" & xlCcaptionas
  18.         Else
  19.             .Label1.Caption = ""
  20.         End If
  21.     End With
  22. End Sub
½Æ»s¥N½X

TOP

¥»©«³Ì«á¥Ñ mark15jill ©ó 2012-10-19 11:15 ½s¿è

¦^´_ 8# GBKEE
  1. Private Sub CommandButton2_Click()

  2.      Dim mycheckbox1 As MSForms.CheckBox

  3.      aois = ActiveSheet.Range("c1").CurrentRegion.Rows.Count

  4.      For gosj = 1 To aois

  5.         With Controls("Checkbox" & gosj)

  6.             If .Value = True Then

  7.                 Label1.Caption = "²{¦b®Ö¿ï¡G" & .Name

  8.             End If

  9.         End With

  10.      Next


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

  ¦h°µ¦h·Q¦h¾Ç²ß¡A¤Ö¬Ý¤Ö¿ù¤Ö°g³~

  ¦h°µ=¦h¦h½m²ß¡A¦h¦h½s¼g¡C
  ¦h·Q=·Q·Q¬°¤°»ò¤H®aµ{¦¡­n¨º¼Ë¼g¡A¦pªG´«¦¨¦Û¤v¡A¤S·|«ç¼g¡C
  ¦h¾Ç²ß=¾Ç²ß¤H®aªºµo°Ý¨Ã¸Ñµª¡A¾Ç²ß¤H®aªº¼gªk

  ¤Ö¬Ý=¥u¬Ý¤£°µ¤]ªPµM

TOP

¦^´_ 8# GBKEE

©êºp ¤p§Ì»¡ªº¤£²M·¡~
¦A¦¸»¡©ú¤p§Ì ªººÃ´bÂI~
¦p¤W­±µ{¦¡©Ò¥Ü¡A¥Ø«e¬O§Q¥ÎCommandButton2 §@¬°Ä²µoÂI(§Y ÂICommandButton2  ¡A Label1.Caption   ¤~·|Åã¥Ü¥Ø«e®Ö¿ï¤§Checkbox ªº Caption­È )  
­Y¥HUserForm_Active  ¬°­ºªº¸Ü¡A¶Õ¥²·|²£¥Í¿ù»~(¦]©|¥¼ ²£¥Í 10*10 ­Ó Checkbox±±¨î¶µ )

ºÃ´bÂI¦p¤U
1.­Y·Q¦b 10*10 ­Ó Checkbox±±¨î¶µ  ²£¥Í«á¡AÂI¿ï¥ô¤@ Checkbox ¡A²£¥Í®ÄªG¦p¦P­ì©l CommandButton2 ¤§®ÄªG¬Û¦P¡A¦ý¤£¥Î³z¹L CommandButton ±±¨î¡A¸Ó¥Î¦óªÌ¤è¦¡´y¼g¤ñ¸û¾A·í¡C
2.­Y®Ö¿ï¬°½Æ¿ï¡A¸Ó¦p¦ó§PÂ_¡H

  ¦h°µ¦h·Q¦h¾Ç²ß¡A¤Ö¬Ý¤Ö¿ù¤Ö°g³~

  ¦h°µ=¦h¦h½m²ß¡A¦h¦h½s¼g¡C
  ¦h·Q=·Q·Q¬°¤°»ò¤H®aµ{¦¡­n¨º¼Ë¼g¡A¦pªG´«¦¨¦Û¤v¡A¤S·|«ç¼g¡C
  ¦h¾Ç²ß=¾Ç²ß¤H®aªºµo°Ý¨Ã¸Ñµª¡A¾Ç²ß¤H®aªº¼gªk

  ¤Ö¬Ý=¥u¬Ý¤£°µ¤]ªPµM

TOP

¦^´_ 7# mark15jill
¨SªþÀÉ,¥u¯à²q²q¬Ý
¥Dµ{¦¡°Ï¶ô   ¬OUserForm¤¤  
Private Sub CommandButton1_Click()   §ï¦¨  
Private Sub UserForm_Activate()  »P Private Sub UserForm_Initialize() ¬O¤@¼Ëªº
¥Dµ{¦¡°Ï¶ô   ¬O¨ä¥L¼Ò²Õ¤¤
  1. Private Sub CommandButton1_Click()
  2. '
  3. '

  4.   Next
  5.    Cells(1, 3).Select
  6. UserForm1.Show   
  7. End Sub     
½Æ»s¥N½X

TOP

RE: Ãö©óCheckbox®Ö¿ï§PÂ_ [¤w¸Ñ¨M]

·PÁ GBKEE  ªº«ü±Ð
¦³§ä¨ì¤èªk¥h§P§O..
  1. Private Sub CommandButton1_Click()
  2.     Dim mycheckbox1 As MSForms.CheckBox
  3.           Columns("a:c").Clear
  4.           Columns("a:c").Select
  5.     For kk = 1 To 100

  6.         Cells(kk, 1) = "¤ý" & kk
  7.          
  8.     Next kk

  9.      aois = ActiveSheet.Range("c1").CurrentRegion.Rows.Count

  10.         Selection.ColumnWidth = 15

  11.    
  12.         For sjy = 1 To 450 Step 45


  13.             For sja = 1 To 900 Step 90

  14.                 Set mycheckbox1 = UserForm1.Frame1.Controls.Add("forms.checkbox.1")

  15.                 With mycheckbox1

  16.                     .Left = 10 + sja

  17.                     .Top = 10 + sjy

  18.                     .Width = 70

  19.                     .Height = 20

  20.                     .TextAlign = fmTextAlignCenter

  21.                     .BackColor = &HFFFFC0

  22.                     .Caption = .Name

  23.                 End With

  24.             Next

  25.         Next

  26.     Dim ct As Control

  27.     r = 1

  28.     For Each ct In Controls

  29.     If TypeName(ct.Object) = "ICheckboxControl" Then ct.Caption = Cells(r, 1): Cells(r, 2) = ct.Name

  30.         Cells(r, 3) = ct.Name: r = r + 1

  31.     Next
  32.       aois = ActiveSheet.Range("c1").CurrentRegion.Rows.Count
  33.     For hh = 1 To aois

  34.         For kh = 1 To aois

  35.             If Cells(hh, 3) <> "" Then

  36.                 If Mid(Cells(hh, 3), 1, 8) <> "CheckBox" Then

  37.                     Range("c" & hh).Select

  38.                     Selection.Delete Shift:=xlUp

  39.                
  40.                 End If

  41.             End If

  42.         Next

  43.     Next
  44.      
  45.     Cells(1, 3).Select


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

Private Sub CommandButton2_Click()
     Dim mycheckbox1 As MSForms.CheckBox
     aois = ActiveSheet.Range("c1").CurrentRegion.Rows.Count
     For gosj = 1 To aois
        With Controls("Checkbox" & gosj)
            If .Value = True Then
                Label1.Caption = "²{¦b®Ö¿ï¡G" & .Name
            
            End If
        End With
     Next
End Sub

  ¦h°µ¦h·Q¦h¾Ç²ß¡A¤Ö¬Ý¤Ö¿ù¤Ö°g³~

  ¦h°µ=¦h¦h½m²ß¡A¦h¦h½s¼g¡C
  ¦h·Q=·Q·Q¬°¤°»ò¤H®aµ{¦¡­n¨º¼Ë¼g¡A¦pªG´«¦¨¦Û¤v¡A¤S·|«ç¼g¡C
  ¦h¾Ç²ß=¾Ç²ß¤H®aªºµo°Ý¨Ã¸Ñµª¡A¾Ç²ß¤H®aªº¼gªk

  ¤Ö¬Ý=¥u¬Ý¤£°µ¤]ªPµM

TOP

¦^´_ 4# GBKEE

©êºp Åý¤j¤j±z¨£¯º¤F~
¦]³Ìªñ  VB2010 ©M VBA ¦P®É¥Î¨ì
¦³¨Ç»yªk »y¦ê ¾É­P±`±`·|²V¶Ã
¦p ¦P¤@¨Æ¥ó ¨âÃ䪺»yªk¥i¯à´N¦³®t²§
¦³¸ÕµÛ­×¥¿  ¦ý¶]¥X¨Óªº¦¨ªG¤£ºÉ²z·Q

¦A¦¸·PÁ¤j¤jªº­@¤ß¸Ñ»¡

  ¦h°µ¦h·Q¦h¾Ç²ß¡A¤Ö¬Ý¤Ö¿ù¤Ö°g³~

  ¦h°µ=¦h¦h½m²ß¡A¦h¦h½s¼g¡C
  ¦h·Q=·Q·Q¬°¤°»ò¤H®aµ{¦¡­n¨º¼Ë¼g¡A¦pªG´«¦¨¦Û¤v¡A¤S·|«ç¼g¡C
  ¦h¾Ç²ß=¾Ç²ß¤H®aªºµo°Ý¨Ã¸Ñµª¡A¾Ç²ß¤H®aªº¼gªk

  ¤Ö¬Ý=¥u¬Ý¤£°µ¤]ªPµM

TOP

        ÀR«ä¦Û¦b : ¥@¤W¦³¨â¥ó¨Æ¤£¯àµ¥¡G¤@¡B§µ¶¶ ¤G¡B¦æµ½¡C
ªð¦^¦Cªí ¤W¤@¥DÃD