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

excel ²£¥Í¦h­Ó®Ö¨ú¤è¶ô.

¦^´_ 14# stillfish00
ÆZ¤£¿ùªº¸àÄÀ¡A¨ü±Ð¤F¡I

TOP

¥»©«³Ì«á¥Ñ stillfish00 ©ó 2013-9-6 11:17 ½s¿è

¦^´_ 12# ML089
½¤F¤@¤U®Ñ¡A¦³¼g¨ì Forms Control ©M ActiveX Control ¦U¦ÛÀuÂI¡A¾ã²z¤@¤U¡C

Forms Control ¡G
    ¡¯¥i¥Î¦b Chart sheets¡AActiveX Control ¤£¯à¡C
    ¡¯»P¤u§@ªíªºµ²¦X¸ûºò±K¡A¹³"¼ÐÅÒ"©Î"«ö¶s"¥i¦b¤½¦¡¦C¥h°Ñ¦Ò¡A¥H°ÊºA¦a³]©w±±¨î¶µ¤å¦r¡C
        ¤S¦p"²M³æ¤è¶ô"¥i¦b¨ä±±¨î¶µªº¿é¤J½d³ò«ü©w¤w©w¸qªº½d³ò¦WºÙ¡C
    ¡¯®e©ö¦P®É«ü©w«Ü¦h­Ó±±¨î¶µ¨ì¦P¤@­ÓVBAµ{§Ç¡A­n¹F¨ì¦P¼Ë¥\¯à ActiveX Control »Ý­n¤ñ¸û½ÆÂøªºª«¥óÃþ§Oªº¤èªk¡C
    ¡¯·í¨Ï¥Î¦hµøµ¡©Î¤À³Îµøµ¡®É¡AActiveX Control ¥u·|§@¥Î¦b­ìµøµ¡¡AForms Control ·|§@¥Î¦b¥ô¦óµøµ¡¡C

ActiveX Control ¡G
    ¡¯ActiveX Control ±±¨î¶µªº¥~Æ[¦³¸û¦hÄÝ©Ê¥i¥H½Õ¾ã¡C
    ¡¯¦³¤ñ¸û¦hºØÃþªº±±¨î¶µ¥i¨Ï¥Î¡C
    ¡¯¥i¥H¦^À³±±¨î¶µ¦hºØ¤£¦PÃþ«¬ªº¨Æ¥ó¡AForms Control ¥u¯à¹ïÀ³°õ¦æ¤@­Ó¥¨¶°¡C

TOP

¦^´_ 12# ML089


·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 9# oobird
¦^´_ 2# oobird

§Ú¥Îoobird¶Wª©2#ªºµ{¦¡½X¥[¤WLinkedCellÄݩʤ]¥i¥H¥Î¨Ó­pºâ¡A¦ý«ö¥kÁä¿ï¶µ¤¤¡u«ü©w¥¨¶°¡v´NÅܦ¨¦Ç¦â¤£¯à¿ï¥Î¡C
OLEObjects.Add¬O§_¤ñCheckBoxes.Add¨Ï¥Î¤W§ó¦³¼u©Ê?
  1. Sub ¿ï¨ú®æ_FormsCheckBox()
  2.     For Each C In Selection.Cells.SpecialCells(2)
  3.         Set b = ActiveSheet.OLEObjects.Add(ClassType:="Forms.CheckBox.1", _
  4.                                            Left:=C.Left, Top:=C.Top, Width:=C.Width, Height:=C.Height)
  5.         b.Object.Caption = C.Value
  6.         b.LinkedCell = C.Address '³sµ²¸Ó¦ì¸m¥HTRUE¡BFALSEªí¥Ü¡A¥H§Q«áÄò²Î­p
  7.         'C.Value = False '°_©l­È³]©w
  8.     Next
  9. End Sub
½Æ»s¥N½X
{...} ªí¥Ü»Ý­n¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡

TOP

¦^´_ 8# GBKEE
¦^´_ 9# oobird

§Ú¥Î±±¨î¤u¨ã½c´¡¤JCheckBox1«á¡A¥H¥kÁä¿ï¥Î¥X²{ªº¬O¡uÀ˵øµ{¦¡½X¡v
§Ú¥Îoobird¤j9#ªºµ{¦¡´¡¤JCheckBoxes«á¡A¥H¥kÁä¿ï¥Î¥X²{ªº¬O¡u«ü©w¥¨¶°¡v
³o¬O¤£¤@¼Ëªºª«¥ó¶Ü?

¡uÀ˵øµ{¦¡½X¡v»P¡u«ü©w¥¨¶°¡vªº¨Ï¥Î¤è¦¡¤£¤@¼Ë¡A½Ð¦U¦ì°ª¤â¦³¨S¦³²ßºD©Ê¥Î¨º¤@ºØ¤ñ¸û¦n¥Î¡C

{...} ªí¥Ü»Ý­n¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡

TOP

¦^´_ 9# oobird


    µ²ªG¦p¹Ï¡G

TOP

­Y§A·Q¥ÎLinkedCellÄÝ©Ê­pºâ¡A¨º´N¬Oªí³æ¤u¨ãªº®Ö¨ú¤è¶ô¤F¡A¥i§ï¦¨³o¼Ë¡G(¨Ò¦pLinkedCell©ñ¦bmÄæ)
  1. Sub test()
  2.     For Each c In ActiveSheet.Cells.SpecialCells(2)
  3.         Set b = ActiveSheet.CheckBoxes.Add(c(1, 2).Left, c.Top, c.Width, c.Height)
  4.         b.Characters.Text = c.Value
  5.         i = i + 1
  6.         b.LinkedCell = Cells(i, 13).Address
  7.     Next
  8. End Sub
½Æ»s¥N½X

TOP

¦^´_ 7# ML089
±±¨î¤u¨ã½cªº±±¨î¶µ,¥i¼gVBA

·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¥»©«³Ì«á¥Ñ ML089 ©ó 2013-9-5 17:31 ½s¿è

¦^´_ 6# GBKEE


    ­ì¨Ó CheckBox »P ®Ö¨ú¤è¶ô¤£¦P¡AÁÂÁ§A¸Ô²Óªº¸Ñ»¡

   ³o¨â­Ó¨Ï¥Î¤W¦³¦ó®t§O?
{...} ªí¥Ü»Ý­n¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡

TOP

¦^´_ 5# ML089

  1. Option Explicit
  2. Sub Ex()
  3.     Dim S As Integer, C As Variant
  4.     For Each C In ActiveSheet.OLEObjects   '±±¨î¤u¨ã½cªº±±¨î¶µ (MSForms.CheckBox)
  5.         If C.Name Like "CheckBox*" Then
  6.             S = S + IIf(C.Object.Value, 1, 0)
  7.         End If
  8.     Next
  9.     MsgBox S
  10.     S = 0
  11.     For Each C In ActiveSheet.CheckBoxes    'ªí³æªº±±¨î¶µ(®Ö¨ú¤è¶ô)
  12.             S = S + IIf(C.Value = 1, 1, 0)
  13.     Next
  14.     MsgBox S
  15. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

        ÀR«ä¦Û¦b : ·O´d¨S¦³¼Ä¤H¡A´¼¼z¤£°_·Ð´o¡C
ªð¦^¦Cªí ¤W¤@¥DÃD