如何設定新增按鈕的位置呢??假設在某列的d欄至h欄中 放置5個按鈕
b為新插入的列
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
如何設定新增按鈕的位置在某列的第d欄至h欄中 放置5個按鈕
(b為新插入的列)
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
b = Range("I1").Value
ActiveSheet.Rows(b).Insert '於第b列插入新的一列
For Each a In Range("C:C").SpecialCells(xlCellTypeConstants)
For i = 1 To 5
Select Case i
Case "1"
mystr = "非常不重要" & "(" & i & ")"
Case "2"
mystr = "不重要" & "(" & i & ")"
Case "3"
mystr = "普通" & "(" & i & ")"
Case "4"
mystr = "重要" & "(" & i & ")"
Case "5"
mystr = "非常重要" & "(" & 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作者: Hsieh 時間: 2012-3-22 10:45