Macro to insert object into spreadsheet ??

  • Thread starter Thread starter kluska
  • Start date Start date
K

kluska

Hi,

I would like to have a square (ie. three cells long) that contain
information that the user must input, and can be moved around th
spreadsheet.
Can I program this in VBA ?

Any help is greatly appreciated.

Ale
 
Sub AddATextBox()
Dim rng As Range, bx As Shape
Set rng = Range("B9:D9")
Set bx = ActiveSheet.Shapes.AddTextbox( _
msoTextOrientationHorizontal, _
Top:=rng.Top, _
Left:=rng.Left, _
Width:=rng.Width, _
Height:=0.75 * rng.Width)
bx.TextFrame.Characters.Text = "Add some text here"
With bx.TextFrame.Characters.Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With

End Sub


is a possibility.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top