Forum Discussion

Abedules's avatar
Abedules
Copper Contributor
Mar 22, 2020
Solved

Creating Macro for Text Box

I am learning about macros in excel. So far I have opened a worksheet, clicked in a cell (D5), recorded a macro of inserting a text box and colouring it brown. The macro is saved in Personal.XLSB ...
  • Riny_van_Eekelen's avatar
    Mar 22, 2020

    Abedules 

     

    Try this one

     

    Sub Create_Brown_Text_Box()
    ' Create_Brown_Text_Box Macro
    
        X = ActiveCell.Left
        Y = ActiveCell.Top
        
        ActiveSheet.Shapes.AddTextbox(msoTextOrientationHorizontal, X, Y, 109.2, _
            77.4).Select
        With Selection.ShapeRange.Fill
            .Visible = msoTrue
            .ForeColor.ObjectThemeColor = msoThemeColorAccent2
            .ForeColor.TintAndShade = 0
            .ForeColor.Brightness = -0.5
            .Transparency = 0
            .Solid
        End With
    
    End Sub

Resources