Firstly I'm new to VBA, but trying to learn to make Excel more useful in work.
My company is using Excel 2003(!) and I'm trying to create custom buttons which add text boxes to selected cells - I want to create a series of buttons to create different coloured text boxes. Through lots of google searching, and some background reading I've managed to come up with the following code to create a text box the size of selected cells:
Despite numerous tries, I can't figure out what code, or where to place it to set parameters such as font size, alignment and fill colour for the text box. Any help greatly appreciated.
My company is using Excel 2003(!) and I'm trying to create custom buttons which add text boxes to selected cells - I want to create a series of buttons to create different coloured text boxes. Through lots of google searching, and some background reading I've managed to come up with the following code to create a text box the size of selected cells:
Code:
Sub TextBox()
If TypeName(Selection) = "Range" Then
With Selection
ActiveSheet.Shapes.AddTextbox _
msoTextOrientationHorizontal, .Left, _
.Top, .Width, .Height
End With
End If
End Sub
Despite numerous tries, I can't figure out what code, or where to place it to set parameters such as font size, alignment and fill colour for the text box. Any help greatly appreciated.