Results 1 to 6 of 6
  1. #1
    3 Star Lounger
    Join Date
    Sep 2001
    Location
    Stuck at work..., Missouri, USA
    Posts
    248
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Put a small square in a cell (2003)

    I have a need to put a small square, roughly 1/4 of the size of a cell (40 pixel by 28 pixel) in the upper right corner using VBA.

    Any suggestions?
    <font face="Comic Sans MS">Morgan Erickson</font face=comic>
    morgan.erickson@sprint.com
    <img src=/S/flags/USA.gif border=0 alt=USA width=30 height=18>-From <img src=/S/flags/Colorado.gif border=0 alt=Colorado width=30 height=18> but living in <img src=/S/flags/Missouri.gif border=0 alt=Missouri width=30 height=18>...and working in Kansas.

  2. #2
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Put a small square in a cell (2003)

    You can use the AddShape method to put a rectangle into a cell, like this:

    <code>
    ActiveSheet.Shapes.AddShape(msoShapeRectangle, 228.75, 0.75, 8.25, 6#). _
    Select
    </code>

    You can use the Top, Left, Width, and Height properties of the range object for the cell to determine where to put the rectangle. Will that do what you want?
    Legare Coleman

  3. #3
    Silver Lounger
    Join Date
    Dec 2000
    Location
    Northampton, Northamptonshire, England
    Posts
    1,951
    Thanks
    2
    Thanked 1 Time in 1 Post

    Re: Put a small square in a cell (2003)

    Hi Legare

    Just being nosey here, why does it only put the square in E1?


    Regards

    Braddy
    If you are a fool at forty, you will always be a fool

  4. #4
    Silver Lounger
    Join Date
    Dec 2000
    Location
    Northampton, Northamptonshire, England
    Posts
    1,951
    Thanks
    2
    Thanked 1 Time in 1 Post

    Re: Put a small square in a cell (2003)

    Hi Legare

    Sorry just realised its not in E1 just position on the page.

    Regards

    Braddy
    If you are a fool at forty, you will always be a fool

  5. #5
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Put a small square in a cell (2003)

    Yes. That is why I said that the Top, Left, Height, and Width properties of the cells' Range Object could be used to determine where to put the rectangle.
    Legare Coleman

  6. #6
    3 Star Lounger
    Join Date
    Sep 2001
    Location
    Stuck at work..., Missouri, USA
    Posts
    248
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Put a small square in a cell (2003)

    That did what I needed, thank you!
    <font face="Comic Sans MS">Morgan Erickson</font face=comic>
    morgan.erickson@sprint.com
    <img src=/S/flags/USA.gif border=0 alt=USA width=30 height=18>-From <img src=/S/flags/Colorado.gif border=0 alt=Colorado width=30 height=18> but living in <img src=/S/flags/Missouri.gif border=0 alt=Missouri width=30 height=18>...and working in Kansas.

Posting Permissions

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