- ©«¤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
|
¥»©«³Ì«á¥Ñ GBKEE ©ó 2012-4-29 13:48 ½s¿è
¦^´_ 1# caichen3
½Ð·s¼W¤@¯ë¼Ò²Õ
©ó³»ºÝ ¿é¤J- Option Explicit
- Public Const OB_Caption1 = "¥\¯à©Ê»Ý¨D"
- Public Const OB_Caption2 = "·P©x©Ê»Ý¨D"
- Public Const OB_Caption3 = "ÁôÂéʻݨD"
½Æ»s¥N½X UserForm1- Private Sub CommandButton1_Click() '«È¤áªº¯u¥¿»Ý¨D¿é¤J
- Dim OB As OLEObject, k As Integer, xR As Integer
- If ComboBox1.ListIndex = -1 Then Exit Sub 'ComboBox1 ªºÈ¤£¦b²M³æ¤º
- With ActiveSheet
- .UsedRange.Offset(11) .Clear '²Ä12¦C¥H¤UªºÀx¦s®æ '²M°£¤º®e
- With .[A12:F12].Resize(ComboBox1.Value) '²Ä12¦C¥H¤UªºÀx¦s®æ ÂX¥R¬°ComboBox1.Value ªº¦C¼Æ½d³ò
- .Borders.LineStyle = xlContinuous
- .Borders.ColorIndex = 1
- End With
- For Each OB In ActiveSheet.OLEObjects
- If OB.progID = "Forms.CheckBox.1" Then
- If OB.TopLeftCell.Row > 11 Then OB.Delete
- End If
- Next
- For k = 1 To ComboBox1.Value
- .Cells(11 + k, "C") = k
- For xR = 0 To 2
- With .Cells(11 + k, "d").Offset(, xR) '±q ²Ä11«á ¶}¨Ï
- Set OB = ActiveSheet.OLEObjects.Add(ClassType:="Forms.CheckBox.1", Left:=.Left, Top:=.Top, Width:=.Width, Height:=.Height)
- OB.Object.Caption = IIf(xR = 0, OB_Caption1, IIf(xR = 1, OB_Caption2, OB_Caption3))
- OB.Object.GroupName = .Row '¥H¦C¸¹¬°¸s²Õ¦WºÙ
- If OB.Object.Caption = OB_Caption3 Then OB.Object.BackColor = &H80FFFF
- End With
- Next
- Next
- End With
- Unload UserForm1
- End Sub
½Æ»s¥N½X ªí6-6- Private Sub CommandButton2_Click() '§R°£
- Dim xR As Integer, OB As OLEObject
- With ActiveSheet
- If ActiveCell.Row > Cells(Rows.Count, "C").End(xlUp).Row Or ActiveCell.Row <= 11 Then Exit Sub
- xR = ActiveCell.Row
- For Each OB In ActiveSheet.OLEObjects
- If OB.Name Like "CheckBox*" Then
- If OB.TopLeftCell.Row = xR Then OB.Delete 'TopLeftCell.Row ±±¨î¶µ©Ò¦bªº¦ì¸m.¦C¸¹
- End If
- Next
- .Cells(xR, "A").Resize(, 6).Delete xlUp
- For Each OB In ActiveSheet.OLEObjects
- If OB.Name Like "CheckBox*" Then
- If OB.TopLeftCell.Row >= xR Then
- '>=TopLeftCell.Row ±±¨î¶µ©Ò¦bªº¦ì¸m.¦C¸¹ ¤~»Ý«·s¾ã²z ¸s²Õ¦WºÙ
- OB.Object.GroupName = OB.TopLeftCell.Row
- .Cells(OB.TopLeftCell.Row, "C") = OB.TopLeftCell.Row - 11
- '³]¸m CÄ檺¼Æ¦r
- End If
- End If
- Next
- End With
- End Sub
- Private Sub CommandButton4_Click() '·s¼W
- Dim xR As Range, xi As Integer
- With ActiveSheet
- Set xR = .Cells(Rows.Count, "C").End(xlUp).Offset(1) 'CÄ檺¼Æ¦r³Ì«á¦³¤@Ó¸ê®ÆªºÀx¦s®æ ©¹¤U¤@¦C
- If xR.Row <= 11 Then Set xR = .Cells(12, "C")
- xR = xR.Row - 11 ' µ¹È : ±q²Ä11 ¦C¶}©l
- For xi = 1 To 3
- With xR.Offset(, xi)
- Set OB = ActiveSheet.OLEObjects.Add(ClassType:="Forms.CheckBox.1", Left:=.Left, Top:=.Top, Width:=.Width, Height:=.Height)
- OB.Object.Caption = IIf(xi = 1, OB_Caption1, IIf(xi = 2, OB_Caption2, OB_Caption3))
- OB.Object.GroupName = xR.Row '¹ïÀ³¦C¸¹
- If OB.Object.Caption = OB_Caption3 Then OB.Object.BackColor = &H80FFFF
- End With
- Next
- With .Range(Cells(xR.Row, "A"), .Cells(xR.Row, "F"))
- .Borders.LineStyle = xlContinuous
- .Borders(xlEdgeRight).ColorIndex = 1
- End With
- End With
- End Sub
½Æ»s¥N½X |
|