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

¦Û°Ê¶ñº¡¿ï¶µ«ö¶s

¥»©«³Ì«á¥Ñ caichen3 ©ó 2012-3-21 18:06 ½s¿è

·PÁÂh¤j¤j:)
½Ð±ÐLeft:=.Left, Top:=.Top, Width:=.Width, Height:=.Height¬O¤°»ò·N«ä©O¡H
­Y§Ú¦b³Ì«á´¡¤J·sªº¤@¦C¡A¨Ã¤]§Æ±æ¦b¸Ó¦C¦³¦Û°Ê·s¼W¤W­z©Ò»¡ªº¤­­Ó«ö¶s¸Ó¦p¦ó©O(ÅܼÆi=1 to 5) ¡H¡H
Ä_Ä_

TOP

¦^´_ 11# caichen3

  ÅýOptionButtonªº¤j¤p¸ò§AÀx¦s®æªºsize¤j¤p¤@¼Ë¤j
¾Ç²ß¤~¯à´£¤É¦Û¤v

TOP

¥»©«³Ì«á¥Ñ caichen3 ©ó 2012-3-21 18:25 ½s¿è

¦p¦ó³]©w·s¼W«ö¶sªº¦ì¸m©O¡H¡H°²³]¦b¬Y¦CªºdÄæ¦ÜhÄ椤 ©ñ¸m5­Ó«ö¶s
b¬°·s´¡¤Jªº¦C
For i = 1 To 5
With a.Offset(, i)
      Set ob = ActiveSheet.OLEObjects.Add(ClassType:="Forms.OptionButton.1")
        ob.Object.Left = ["D+b:" & "H+b"].Left
        ob.Object.Top = ["D+b:" & "H+b"].Top
        ob.Object.Width = ["D+b:" & "H+b"].Width
        ob.Object.Height = ["D+b:" & "H+b"].Height
   End With
   Next

µ{¦¡½X¥X¿ù¡A¥i¥HÀ°§Ú¬Ý¬Ý¶Ü¡H·PÁÂ
Ä_Ä_

TOP

¦^´_ 13# caichen3
  1. Sub ex()
  2. Dim ob As OLEObject
  3. For Each ob In ActiveSheet.OLEObjects
  4.    If ob.progID = "Forms.OptionButton.1" Then ob.Delete
  5. Next
  6. For Each a In Range("A:A").SpecialCells(xlCellTypeConstants)
  7.    s = 0
  8.    For i = 1 To 5
  9.    With a.Offset(, i)
  10.       Set ob = ActiveSheet.OLEObjects.Add(ClassType:="Forms.OptionButton.1", _
  11.          Left:=.Left, Top:=.Top, Width:=.Width, Height:=.Height)
  12.          ob.Top = .Top + 2       '«ö¶s¦b¨C­ÓÀx¦s®æªº¶ZÂ÷topªº¶ZÂ÷
  13.          ob.Left = .Left + 10    '«ö¶s¦b¨C­ÓÀx¦s®æªº¶ZÂ÷leftªº¶ZÂ÷
  14.          ob.Object.GroupName = "¸s²Õ " & n
  15.    End With
  16.    Next
  17.   n = n + 1
  18. Next
  19. End Sub
½Æ»s¥N½X
¾Ç²ß¤~¯à´£¤É¦Û¤v

TOP

¦p¦ó³]©w·s¼W«ö¶sªº¦ì¸m¦b¬Y¦Cªº²ÄdÄæ¦ÜhÄ椤 ©ñ¸m5­Ó«ö¶s
(b¬°·s´¡¤Jªº¦C)
For i = 1 To 5
With a.Offset(, i)
      Set ob = ActiveSheet.OLEObjects.Add(ClassType:="Forms.OptionButton.1")
        ob.Object.Left = ["D+b:" & "H+b"].Left
        ob.Object.Top = ["D+b:" & "H+b"].Top
        ob.Object.Width = ["D+b:" & "H+b"].Width
        ob.Object.Height = ["D+b:" & "H+b"].Height
   End With
   Next

µ{¦¡½X¥X¿ù¡A¥i¥HÀ°§Ú¬Ý¬Ý¶Ü¡H·PÁÂ
Ä_Ä_

TOP

¦^´_ 15# caichen3

¤£ª¾©Ò¤ª¡A¬Æ»ò¥s°µb¬O´¡¤Jªº¦C?
¤W¶ÇÀÉ®×»¡©ú´¡¤J«e«áªºª¬ªp
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

´¡¤J·sªº¤@¦C¡A¨Ã©ó¸Ó¦C¤¤²ÄdÄæ¦ÜhÄ椤©ñ¸m5­Ó¿ï¶µ«ö¶s¡A¥H¤U¬O§Úªº³¡¥÷µ{¦¡½X¡A½Ð¤j¤jÀ°§Ú¬Ý¬Ý­þ¸Ì¥X¿ù¶Ü¡G

b = Range("I1").Value  
ActiveSheet.Rows(b).Insert   '©ó²Äb¦C´¡¤J·sªº¤@¦C
For Each a In Range("C:C").SpecialCells(xlCellTypeConstants)
   For i = 1 To 5
    Select Case i
        Case "1"
        mystr = "«D±`¤£­«­n" & "(" & i & ")"
        Case "2"
        mystr = "¤£­«­n" & "(" & i & ")"
        Case "3"
        mystr = "´¶³q" & "(" & i & ")"
        Case "4"
        mystr = "­«­n" & "(" & i & ")"
        Case "5"
        mystr = "«D±`­«­n" & "(" & i & ")"
    End Select
   
   With a.Offset(, i)
      Set ob = ActiveSheet.OLEObjects.Add(ClassType:="Forms.OptionButton.1")
          ob.Object.Left = ["D+b:" & "H+b"].Left
          ob.Object.Top = ["D+b:" & "H+b"].Top
          ob.Object.Width = ["D+b:" & "H+b"].Width
          ob.Object.Height = ["D+b:" & "H+b"].Height
          ob.Object.Caption = mystr
   End With
   Next
Next
Ä_Ä_

TOP

¦^´_ 17# caichen3

§Aªºµ{¦¡½X¨Ó¬Ý
¦bb¦C´¡¤J·sªº¤@¦C¡A»P·s¼W±±¨î¶µ¦³¦óÃö«Y?
¦A²q¤@¦¸¬Ý¬Ý¡A¥i¯à¬O¦b¤U²¾I1¦Cªº¦ì¸m´¡¤J±±¨î¶µ§a
¦AµLªk´y­z²M·¡§Aªº»Ý¨D¡A¥i¯à´NµL¯à¬°¤O¤F
  1. Sub ex()
  2. Dim ob As OLEObject
  3. For Each ob In ActiveSheet.OLEObjects
  4.    If ob.progID = "Forms.OptionButton.1" Then ob.Delete
  5. Next
  6. For Each a In Range("A:A").SpecialCells(xlCellTypeConstants)
  7. a.Offset([I1]).EntireRow.Insert
  8.    For i = 1 To 5
  9.    mystr = IIf(i = 1, "«D±`¤£­«­n", IIf(i = 2, "¤£­«­n", IIf(i = 3, "´¶³q", IIf(i = 4, "­«­n", "«D±`­«­n"))))
  10.    With a.Offset([I1], i)
  11.       Set ob = ActiveSheet.OLEObjects.Add(ClassType:="Forms.OptionButton.1", _
  12.          Left:=.Left, Top:=.Top, Width:=.Width, Height:=.Height)
  13.          ob.Object.Caption = mystr
  14.          ob.Object.GroupName = "¸s²Õ " & n
  15.    End With
  16.    Next
  17. Next

  18. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¥»©«³Ì«á¥Ñ hugh0620 ©ó 2012-3-22 11:06 ½s¿è

¦^´_ 15# caichen3


    ¤£­nÅýH¤j¤j©Î¨ä¥L¤H²q´ú§A­nªºµ²ªG~
    ¥i¥H°µ¤@­Ó¹Ï¨Ò©ÎÀÉ®×½d¥»~
    ±N§A­nªºµ²ªG~ §e²{¥X¨Ó~ ¤ñ¸û¦n³B²z­ò~
¾Ç²ß¤~¯à´£¤É¦Û¤v

TOP

ª©¥D½Ð±Ð±z¡G
§Ú¨Ï¥Î¤F   ¶}µo¤H­û->´¡¤J->«ö¶s(ªí³æ±±¨î¶µ) ¡A ¤@­Ó¦W¬°¶}±Ò¶s¡A¥t¤@­Ó¬°Ãö³¬¶s¡C
½Ð±Ð±z¡A·í§Ú·Q­n¦b EXCEL ¶}±Ò®É¡A¶}±Ò¶s¬°ÁôÂÃ(Hide)¼Ò¦¡¡A·í§Ú¿ï«öÃö³¬¶s®É¡A
¶}±Ò¶s´NÅã¥Ü¥X¨Ó(Enable)¡AÃö³¬¶s´N¦P®ÉÅܧó¬°ÁôÂÃ(Hide)¼Ò¦¡¡A¤Ï¤§¥çµM¡C
¦]¬°§Ú¦bVBA½s¿è¾¹¤º¡A¤£ª¾­n¦p¦ó±oª¾³o¨Ç«ö¶sªºObject Name¡A¥H¤Î¯à§_¨Ï¥Î
Enable©ÎDisable»yªk¡A³Ó¦ÜÁÙ·Q±N'¶}±Ò'¦r¥y§ï¬°¨ä¥L¦r»y©ÎÅܧóÃC¦âµ¥µ¥¡A¦b¦¹ÁÂÁ±z¤F¡I

TOP

        ÀR«ä¦Û¦b : ¡i»X½ªªº¦Û¥Ñ¡j¤H±`¦b¤°»ò³£¥i¥H¦Û¥Ñ¦Û¦bªº®É­Ô¡A«o³Q³oºØÀH¤ß©Ò±ýªº¦Û¥Ñ»X½ª¡AµêÂY®É¥ú¦Ó²@µLıª¾¡C
ªð¦^¦Cªí ¤W¤@¥DÃD