Sub セルのとなりに四角を生成()
' Dim c As Range
Dim textbox1 As Shape
'
'セル選択し、ボタンを押すと、セルのとなりにtextboxを生成する
'
Set c = Selection
Set textbox1 = ActiveSheet.Shapes.AddShape( _
msoShapeRectangle, _
Left:=c.Offset(0, 1).Left, _
Top:=c.Offset(0, 1).Top, _
Width:=c.Offset(0, 1).Width, _
Height:=c.Offset(, 1).Height)
With textbox1.Fill
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorBackground1
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = -0.25
.Transparency = 0
.Solid
End With
textbox1.Line.Visible = msoFalse
' textbox1.TextFrame.Characters.Text = c
'textbox1.Fill.ForeColor.ColorIndex = 2
' textbox1.Fill.ForeColor.RGB = RGB(255, 255, 0)
'textbox1.Fill.Transparency = 1 '透明
End Sub
Sub セルのとなりにtextboxを生成()
' Dim c As Range
Dim textbox1 As Shape
'
'セル選択し、ボタンを押すと、セルのとなりにtextboxを生成する
'
Set c = Selection
' Set textbox1 = ActiveSheet.Shapes.AddTextbox( _
' Orientation:=msoTextOrientationHorizontal, _
' Left:=c.Offset(0, 1).Left, _
' Top:=c.Offset(0, 1).Top, _
' Width:=c.Offset(0, 1).Width, _
' Height:=c.Offset(, 1).Height).Select
Set textbox1 = ActiveSheet.Shapes.AddTextbox( _
msoTextOrientationHorizontal, _
c.Offset(0, 1).Left, _
c.Offset(0, 1).Top, _
c.Offset(0, 1).Width, _
c.Offset(, 1).Height)
textbox1.TextFrame.Characters.Text = c
' textbox1.Fill.ForeColor.ColorIndex = 2
textbox1.Fill.ForeColor.RGB = RGB(255, 255, 0)
textbox1.Fill.Transparency = 1 '透明
End Sub