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

[µo°Ý] CheckBox ¤Î optionbutton ÂI¿ï¿ï¶µ«á ¥i§_³]­p±a¥Xtextbox ¿é¤J¸ê®Æ

¦^´_ 1# user999
  1. Option Explicit
  2. Private Sub UserForm_Initialize()
  3.     Dim LeftPos As Integer, TopPos As Integer, NewHeight As Integer, NewWidth As Integer, Rng As Range, H As Integer, i As Integer
  4.     Dim NewOptionButton As MSForms.Control
  5.     H = 1
  6.     NewHeight = 15
  7.     With Sheet1
  8.         With .Columns(1)
  9.             Set Rng = Sheet1.Range(.Cells(2), .Cells(2).End(xlDown))
  10.             ComboBox1.List = Rng.Value
  11.         End With
  12.         With .Columns(2)
  13.             Set Rng = Sheet1.Range(.Cells(2), .Cells(2).End(xlDown))
  14.             NewWidth = (Frame2.Width - (Rng.Count * H)) / Rng.Count
  15.             TopPos = (Frame2.Height - NewHeight) / 2
  16.             For i = 1 To Rng.Count
  17.                 LeftPos = 1 * H + (i - 1) * NewWidth
  18.                 Set NewOptionButton = _
  19.                 Frame2.Controls.Add("forms.OptionButton.1")
  20.                 With NewOptionButton
  21.                     .Width = NewWidth
  22.                     .Caption = Rng.Cells(i)
  23.                     .Height = NewHeight
  24.                     .Left = LeftPos
  25.                     .Top = TopPos
  26.                     .AutoSize = True
  27.                 End With
  28.             Next
  29.         End With
  30.         With .Columns(3)
  31.             Set Rng = Sheet1.Range(.Cells(2), .Cells(2).End(xlDown))
  32.             NewWidth = (Frame3.Width - (Rng.Count * H)) / Rng.Count
  33.             TopPos = (Frame3.Height - NewHeight) / 2
  34.             For i = 1 To Rng.Count
  35.                 LeftPos = 1 * H + (i - 1) * NewWidth
  36.                 Set NewOptionButton = _
  37.                 Frame3.Controls.Add("forms.CheckBox.1")
  38.                 With NewOptionButton
  39.                     .Width = NewWidth
  40.                     .Caption = Rng.Cells(i)
  41.                     .Height = NewHeight
  42.                     .Left = LeftPos
  43.                     .Top = TopPos
  44.                     .AutoSize = True
  45.                 End With
  46.             Next
  47.         End With
  48.     End With
  49. End Sub
½Æ»s¥N½X

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2012-7-26 17:44 ½s¿è

¦^´_ 5# user999
¥t¤@°ÝÃD optionbutton ¤Î checkbox ¤º®e¤@¦h°_¨Ó,¦bfram2,,fram3¤¤,©Ò¦³ªºoption¶È¤@¦æ·|Åã¥Ü(À£ÁY·|¬Ý¤£¨ì,)¦p¦óÅý¥¦´«¦æ
¦pªG¦h¨ìFrame2 ©Î Frame3 ´«¦æ«áÁÙ¬O®e¤£¤U¥h¸Ó¦p¦ó³B¸m?
©Ò¥H«Øij§A¦b Frame2 ¥ÎComboBox ±±¨î¶µ  ³æ¿ï , Frame3 ¥ÎListBox ±±¨î¶µ ¥i½Æ¿ï

TOP

¦^´_ 1# user999
Ãþ¦üªº «¬ºA °Ñ¦Ò°Ñ¦Ò

TEST.rar (20.66 KB)

TOP

¦^´_ 11# user999
ListBox1 «á ­Y­n¨ú®ø, ¥u¯à¿é0ªí¥Ü,µLªk«ì´_¥¼¿ïª¬ºA§a!
­×§ï¦p¤U
  1. Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
  2.     Dim ListText As Integer, i As Integer
  3.     i = ListBox1.ListIndex
  4.     ListText = Val(ListBox1.List(i, 1))
  5.     ListText = Application.InputBox("½Ð¿é¤J¼Æ¦r : ", ListBox1.List(i), ListText, Type:=1)
  6.     If ListText >= 0 Then
  7.         If ListText > 0 Then ListBox1.List(i, 1) = ListText    '>0 ¿é¤J¼Æ­È
  8.         If ListText = 0 Then ListBox1.List(i, 1) = ""          '=0 ²M°£¤º®e
  9.     End If
  10.     Ar(ComboBox2.ListIndex) = Application.Transpose(Application.Transpose(ListBox1.List))
  11.                                           '«~§O°}¦Cªº¯Á¤Þ¤§°}¦C = ListBox1
  12.     ITEM(ComboBox1.ListIndex) = Ar        '©±§O°}¦Cªº¯Á¤Þ¤§°}¦C = «~§O°}¦C
  13.     Åã¥Ü­p¼Æ
  14. End Sub
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : ­n¤ñ½Ö§ó¨ü½Ö¡D¤£­n¤ñ½Ö§ó©È½Ö¡C
ªð¦^¦Cªí ¤W¤@¥DÃD