软件: Excel
版本: 2016
想用VBA来新增文字方块到储存格中间,目前写到下面这样:
Dim textbox As String
textbox = "A"
Dim rng As Range: Set rng = Application.Selection
Dim cel As Range
For Each cel In rng
With ActiveSheet.Shapes.AddTextbox(msoTextOrientationHorizontal, cel.Left +
(cel.Width / 2) - 3, cel.Top - cel.Height, 50, 50)
.TextFrame.Characters.Text = textbox
.TextFrame.AutoSize = True
End With
Next cel
在默认列高的状况下是没什么问题,
可是如果该列比较高的话,用Height来控制位置的话,新增的文字方块就会跑掉位置
想请问有什么解法呢?
感谢!