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

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

´¡¤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

¦^´_ 15# caichen3

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

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

¦^´_ 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

¥»©«³Ì«á¥Ñ 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

¦^´_ 11# caichen3

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

TOP

¥»©«³Ì«á¥Ñ 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

¦^´_ 9# 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. n = 0
  7. For Each a In Range("A:A").SpecialCells(xlCellTypeConstants)
  8.    For i = 1 To 5
  9.    mystr = "¿ï¶µ" & n & "-" & i
  10.    With a.Offset(, 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.   n = n + 1
  18. Next
  19. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

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

·PÁÂH¤j¤jªº¦^ÂСI¡IÁÙ¦³¤@­Ó°ÝÃD½Ð±Ð§A¡A
OLEobjects¤èªk¼W¥[ªºoptionbutton,¨C­Ó³£¦³½s¸¹¡A¨C¦¸°õ¦æ«ö¶sªº½s¸¹¨Ã¤£¬O¨Ì§Ç±Æ¦C¡A
¦]¬°§Ú­n³]©w¨C­Ó«ö¶sªº¼ÐÃD¤å¦r¡A­n¦p¦ó¥HÅܼÆI¨Ó±±¨î¨Ã³]©w³o¢´­Ó«ö¶sªº¼ÐÃD¤å¦r¡H¡H
Ä_Ä_

TOP

¦^´_ 7# caichen3


    ctiveSheet.OLEObjects.Delete
´N¤w¸g±N©Ò¦³±±¨î¶µ§R°£
¥Øªº¦b©È­«½Æ°õ¦æµ{¦¡¡A³y¦¨±±¨î¶µ­«½Æ·s¼W
  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.Object.GroupName = "¸s²Õ " & n
  13.    End With
  14.    Next
  15.   n = n + 1
  16. Next
  17. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

        ÀR«ä¦Û¦b : ¡i®É¶¡¦¨´N¤@¤Á¡j®É¶¡¥i¥H³y´N¤H®æ¡A¥i¥H¦¨´N¨Æ·~¡A¤]¥i¥HÀx¿n¥\¼w¡C
ªð¦^¦Cªí ¤W¤@¥DÃD