Consulting

Results 1 to 3 of 3

Thread: How do I avoid selecting Shapes?

  1. #1
    VBAX Master paulked's Avatar
    Joined
    Apr 2006
    Posts
    1,007
    Location

    How do I avoid selecting Shapes?

    Trimming down from the macro recorder I ended up with this:

        For x = 1 To 17
            ActiveSheet.Shapes.Range(Array("Rounded Rectangle " & x + 16)).Select
            Selection.Text = Sheet2.Cells(3, x + 1).Value
            Selection.ShapeRange.TextFrame2.TextRange.Font.Size = 16
            Selection.ShapeRange.TextFrame2.TextRange.Font.Bold = msoTrue
        Next
    I tried to avoid the selection, wrongly!, by doing this:

        For x = 1 To 17
            With ActiveSheet.Shapes.Range(Array("Rounded Rectangle " & x + 16))
                .Text = Sheet2.Cells(3, x + 1).Value
                .ShapeRange.TextFrame2.TextRange.Font.Size = 16
                .ShapeRange.TextFrame2.TextRange.Font.Bold = msoTrue
            End With
        Next
    Anyone willing to share the dark magic of Shapes with me please?

    Thanks
    Semper in excretia sumus; solum profundum variat.

  2. #2
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    With ActiveSheet.Shapes("Rounded Rectangle " & x + 16).OLEFormat.Object

  3. #3
    VBAX Master paulked's Avatar
    Joined
    Apr 2006
    Posts
    1,007
    Location
    Many thanks, I don't work with shapes very often. I'll try to remember that... but how you remembered it is quite exceptional!
    Semper in excretia sumus; solum profundum variat.

Posting Permissions

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