軟體: 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來控制位置的話,新增的文字方塊就會跑掉位置
想請問有什麼解法呢?
感謝!