Results 1 to 2 of 2
  1. #1
    New Lounger
    Join Date
    Jul 2011
    Posts
    9
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Excel, help with selection data

    I need help. I have textboxes (textbox1, textbox2, etc.). I need to create a new textbox# below whichever textbox# I have selected when I press a macro.

    All textboxes appear the same size/shape/color. Each textbox is H: 0.6" W:1.3" (approx 3x2 cells in excel). The space between the selected textbox# and the new textbox# needs to be the size of one textbox (3x2 cells between).

    I have the code for creating the text box (CODE1). I just need help with the code that detects the selected textbox# location and then counts down 3 cells and then builds the new textbox# at that location. I'm having a hard time finding how to detect the selected textbox and/or the cell that the selected textbox is in.

    CODE1
    Sub Form_Box1_Blue()
    '
    ' Form_Box1_Blue Macro
    '

    '
    With Selection.ShapeRange.Fill
    .Visible = msoTrue
    .ForeColor.ObjectThemeColor = msoThemeColorAccent5
    .ForeColor.TintAndShade = 0.3399999738
    .ForeColor.Brightness = 0.400000006
    .BackColor.ObjectThemeColor = msoThemeColorAccent5
    .BackColor.TintAndShade = 0.7649999857
    .BackColor.Brightness = 0.400000006
    .TwoColorGradient msoGradientDiagonalDown, 1
    .RotateWithObject = msoTrue
    .Transparency = 0
    .Solid
    End With
    With Selection.ShapeRange.ThreeD
    .BevelTopType = msoBevelCircle
    .BevelTopInset = 6
    .BevelTopDepth = 6
    End With
    With Selection.ShapeRange.Fill
    .Visible = msoTrue
    .ForeColor.ObjectThemeColor = msoThemeColorAccent5
    .ForeColor.TintAndShade = 0.3399999738
    .ForeColor.Brightness = 0.400000006
    .BackColor.ObjectThemeColor = msoThemeColorAccent5
    .BackColor.TintAndShade = 0.7649999857
    .BackColor.Brightness = 0.400000006
    .TwoColorGradient msoGradientDiagonalDown, 1
    .RotateWithObject = msoTrue
    End With
    With Selection.ShapeRange.Line
    .Visible = msoTrue
    .Weight = 0.25
    End With
    End Sub
    Sub Remove_Colors_Box1()
    '
    ' Remove_Colors_Box1 Macro
    '
    '
    Selection.ShapeRange.TextFrame2.TextRange.Font.Fil l.Visible = msoFalse
    Selection.ShapeRange.TextFrame2.TextRange.Font.Lin e.Visible = msoFalse
    Selection.ShapeRange.TextFrame2.TextRange.Font.Sha dow.Visible = msoFalse
    Selection.ShapeRange.Fill.Visible = msoFalse
    Selection.ShapeRange.Line.Visible = msoFalse
    Selection.ShapeRange.ThreeD.Visible = msoFalse
    End Sub

  2. #2
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts
    The Column to start the new textbox is:

    selection.topleftcell.column

    3 rows down from the textbox is:
    selection.bottomrightcell.row +3

    Steve

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •