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

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

¦^´_ 3# mark15jill
§AªþÀÉ¼Ò²Õ ¨S¥[¤W  Option Explicit  ©Ò¥H§Ú´ú¸Õ®É¬O¨S°ÝÃD
¨Ì§Aªº¯à¤O,¬O¥i¥H¸ÕµÛ­×§ïªº
2#
  1. Private Sub CommandButton1_Click()
  2.     Dim mycheckbox1 As MSForms.CheckBox
  3.     Dim Sh As Worksheet
  4.     Set Sh = ActiveSheet ' **¤Ö¤F³oµ{¦¡½X½Ð¥[¤J **
½Æ»s¥N½X

TOP

¦^´_ 2# GBKEE

¤j¤j ÁÂÁ±zªº¸Ñµª¡C
¦ý¥X²{  ReDim Preserve TheCheck(0 To         Åܼƥ¼©w¸q

  ¦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-18 09:15 ½s¿è

¦^´_ 1# mark15jill
¨Ï¥Îª«¥óÃþ§O ¸Õ¸Õ¬Ý
  1. Dim TheCheck() As New Class1  '°ÊºA°}¦C «Å§i¬°·sªºClass1ª«¥óÃþ§Oª«¥ó
  2. Private Sub CommandButton1_Click()
  3.     Dim mycheckbox1 As MSForms.CheckBox
  4.     Dim Sh As Worksheet
  5.      Set Sh = ActiveSheet   
  6.     Sh.Columns("c:c").Clear
  7.     Sh.Columns("c:c").ColumnWidth = 15
  8.     kk = 1
  9.     For sjy = 1 To 450 Step 45
  10.         For sja = 1 To 900 Step 90
  11.             With Frame1.Controls.Add("forms.checkbox.1")
  12.                 Sh.Cells(kk, 1) = "¤ý" & kk
  13.                 Sh.Cells(kk, 3) = .Name
  14.                 .Left = 10 + sja
  15.                 .Top = 10 + sjy
  16.                 .Width = 70
  17.                 .Height = 20
  18.                 .TextAlign = fmTextAlignCenter
  19.                 .BackColor = &HFFFFC0
  20.                 .Caption = Sh.Cells(kk, 1)
  21.                 ReDim Preserve TheCheck(0 To kk - 1)              '­«·s°t¸m °ÊºA°}¦C
  22.                 Set TheCheck(kk - 1).xlCheckbox = Controls(.Name)
  23.                 '°ÊºA°}¦Cªº¤¸¯À «ü©w¨ìª«¥ó¼Ò²Õ¤ºªºª«¥ó
  24.             End With
  25.             kk = kk + 1
  26.         Next
  27.     Next
  28. End Sub
½Æ»s¥N½X
  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 = xlCheckbox.Caption
  6. End Sub
½Æ»s¥N½X

TOP

Ãö©óCheckbox®Ö¿ï§PÂ_

¤w³] 10 * 10 ­Ó Checkbox ±±¨î¶µ
·Q½Ð°Ý  ¦p¦óÀH¾÷®Ö¿ï®É ¦bLabel1.Caption  ¥X²{¸Ó±±¨î¶µ¤§Caption ¤º®e¡C
  1. Private Sub CommandButton1_Click()
  2.     Dim mycheckbox1 As MSForms.CheckBox
  3.     For kk = 1 To 100
  4.         Cells(kk, 1) = "¤ý" & kk
  5.     Next kk
  6.          Columns("c:c").Clear
  7.           Columns("c:c").Select
  8.         Selection.ColumnWidth = 15
  9.    
  10.         For sjy = 1 To 450 Step 45

  11.             For sja = 1 To 900 Step 90
  12.                 Set mycheckbox1 = UserForm1.Frame1.Controls.Add("forms.checkbox.1")
  13.                 With mycheckbox1
  14.                     .Left = 10 + sja
  15.                     .Top = 10 + sjy
  16.                     .Width = 70
  17.                     .Height = 20
  18.                     .TextAlign = fmTextAlignCenter
  19.                     .BackColor = &HFFFFC0
  20.                     .Caption = .Name
  21.                 End With
  22.             Next
  23.         Next
  24.     Dim ct As Control

  25.     r = 1
  26.     For Each ct In Controls
  27.     If TypeName(ct.Object) = "ICheckboxControl" Then ct.Caption = Cells(r, 1): Cells(r, 2) = ct.Name
  28.         Cells(r, 3) = ct.Name: r = r + 1
  29.     Next
  30.      aois = ActiveSheet.Range("c1").CurrentRegion.Rows.Count
  31.     For hh = 1 To aois
  32.         For kh = 1 To aois
  33.             If Cells(hh, 3) <> "" Then
  34.                 If Mid(Cells(hh, 3), 1, 8) <> "CheckBox" Then
  35.                     Range("c" & hh).Select
  36.                     Selection.Delete Shift:=xlUp
  37.                
  38.                 End If
  39.             End If
  40.         Next
  41.     Next
  42.         
  43.    
  44.     Cells(1, 3).Select
  45. End Sub
½Æ»s¥N½X
¦Û³Ðcheckbox.rar (19.46 KB)

  ¦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 : ¹D¼w¬O´£ª@¦Û§Úªº©ú¿O¡A¤£¸Ó¬O¨þ¥¸§O¤HªºÃ@¤l¡C
ªð¦^¦Cªí ¤W¤@¥DÃD