- ©«¤l
- 5923
- ¥DÃD
- 13
- ºëµØ
- 1
- ¿n¤À
- 5986
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW°ò¶©
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2022-1-23
|
¦^´_ 1# user999 - Option Explicit
- Private Sub UserForm_Initialize()
- Dim LeftPos As Integer, TopPos As Integer, NewHeight As Integer, NewWidth As Integer, Rng As Range, H As Integer, i As Integer
- Dim NewOptionButton As MSForms.Control
- H = 1
- NewHeight = 15
- With Sheet1
- With .Columns(1)
- Set Rng = Sheet1.Range(.Cells(2), .Cells(2).End(xlDown))
- ComboBox1.List = Rng.Value
- End With
- With .Columns(2)
- Set Rng = Sheet1.Range(.Cells(2), .Cells(2).End(xlDown))
- NewWidth = (Frame2.Width - (Rng.Count * H)) / Rng.Count
- TopPos = (Frame2.Height - NewHeight) / 2
- For i = 1 To Rng.Count
- LeftPos = 1 * H + (i - 1) * NewWidth
- Set NewOptionButton = _
- Frame2.Controls.Add("forms.OptionButton.1")
- With NewOptionButton
- .Width = NewWidth
- .Caption = Rng.Cells(i)
- .Height = NewHeight
- .Left = LeftPos
- .Top = TopPos
- .AutoSize = True
- End With
- Next
- End With
- With .Columns(3)
- Set Rng = Sheet1.Range(.Cells(2), .Cells(2).End(xlDown))
- NewWidth = (Frame3.Width - (Rng.Count * H)) / Rng.Count
- TopPos = (Frame3.Height - NewHeight) / 2
- For i = 1 To Rng.Count
- LeftPos = 1 * H + (i - 1) * NewWidth
- Set NewOptionButton = _
- Frame3.Controls.Add("forms.CheckBox.1")
- With NewOptionButton
- .Width = NewWidth
- .Caption = Rng.Cells(i)
- .Height = NewHeight
- .Left = LeftPos
- .Top = TopPos
- .AutoSize = True
- End With
- Next
- End With
- End With
- End Sub
½Æ»s¥N½X |
|