- ©«¤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-9 16:15 ½s¿è
¦^´_ 24# caichen3
¸Õ¸Õ¬Ý- Option Explicit
- Private Sub CommandButton4_Click()
- Dim xR As Integer, Ar(1 To 5), xi As Integer, OB As OLEObject
- With ActiveSheet
- .CommandButton4.Placement = xlFreeFloating
- xR = .Cells(Rows.Count, "A").End(xlUp).Row 'AÄæ³Ì«á¦³¸ê®Æªº¦C¸¹
- Ar(1) = xR & "«D±`¤£«n" & "(" & xR & ")"
- Ar(2) = xR & "¤£«n" & "(" & xR & ")"
- Ar(3) = xR & "´¶³q" & "(" & xR & ")"
- Ar(4) = xR & "«n" & "(" & xR & ")"
- Ar(5) = xR & "«D±`«n" & "(" & xR & ")"
- For xi = 1 To 5
- With .Cells(xR + 1, "A").Offset(, xi + 2) '¥HAÄ欰¥D ³Ì«á¦³¸ê®Æªº¦C¸¹ + 1¦Cªº¦ì¸m
- Set OB = ActiveSheet.OLEObjects.Add(ClassType:="Forms.OptionButton.1", Left:=.Left, Top:=.Top, Width:=.Width, Height:=.Height)
- OB.Object.Caption = Ar(xi)
- OB.Object.GroupName = "Row" & xR + 1 '¹ïÀ³¦C¸¹
- End With
- Next
- With .Range(.Cells(2, "A"), .Cells(xR + 1, "A")).Resize(, 8) 'A2:H & xR + 1
- .Columns(1) = "=row()-1" 'AÄ椽¦¡ ¨Ì¦C¸¹-1
- .Columns(1) = .Columns(1).Value '±N¤½¦¡ Âন È
- .Columns(1).Interior.ColorIndex = 15
- .Borders.LineStyle = xlContinuous
- .Borders(xlEdgeBottom).Weight = xlThick
- .Borders(xlEdgeRight).Weight = xlThick
- .Borders(xlEdgeLeft).Weight = xlThick
- End With
- End With
- End Sub
- Private Sub CommandButton5_Click()
- Dim xR As Integer, OB As OLEObject, Sp As Variant, MyStr As String
- With ActiveSheet
- .CommandButton5.Placement = xlFreeFloating
- If ActiveCell.Row > .Cells(Rows.Count, "A").End(xlUp).Row Then Exit Sub '¤£¬O½d³ò¤¤
- xR = ActiveCell.Row '¨ú±o §@¥ÎÀx¦s®æªº¦C¸¹
- For Each OB In ActiveSheet.OLEObjects
- If OB.Name Like "OptionButton*" Then
- If OB.Object.GroupName = "Row" & xR Then OB.Delete '§R°£§@¥ÎÀx¦s®æªº¦C¸¹ ¸s²Õ
- End If
- Next
- .Cells(xR, "A").Resize(, 8).Delete xlUp '§R°£§@¥ÎÀx¦s®æ AÄæ¨ìHÄæ
- xR = .Cells(Rows.Count, "A").End(xlUp).Row
- With .Range(.Cells(2, "A"), .Cells(xR, "A")).Resize(, 8) 'A2:H & xR :½d³ò¤¤
- .Columns(1) = "=row()-1"
- .Columns(1) = .Columns(1).Value
- .Columns(1).Interior.ColorIndex = 15
- .Borders.LineStyle = xlContinuous
- .Borders(xlEdgeBottom).Weight = xlThick
- .Borders(xlEdgeRight).Weight = xlThick
- .Borders(xlEdgeLeft).Weight = xlThick
- End With
- For Each OB In .OLEObjects '«·s°t¸m OptionButtonªº¤å¦r ¤Î GroupName
- If OB.Name Like "OptionButton*" Then
- Sp = Split(OB.TopLeftCell.Address(), "$") '©î¸Ñ OptionButton ©Ò¦bµ´¹ï¦ì ¸m¨Ò: $D$5
- Select Case Sp(1)
- Case "D"
- MyStr = "«D±`¤£«n"
- Case "E"
- MyStr = "¤£«n"
- Case "F"
- MyStr = "´¶³q"
- Case "G"
- MyStr = "«n"
- Case "H"
- MyStr = "«D±`«n"
- End Select
- OB.Object.Caption = Sp(2) - 1 & MyStr & "(" & Sp(2) - 1 & ")"
- OB.Object.GroupName = "Row" & Sp(2) '¹ïÀ³¦C¸¹
- End If
- Next
- End With
- End Sub
½Æ»s¥N½X |
|