How can I find the x-y coordinates of the upper-left corner of a cell?
I want to insert two overlapping rectangles (msoShapeRectangle) of
different colors into the cell to illustrate the percentage value
displayed in an adjacent cell. Row heights an column widths on the
sheet are not predictable.
Thanks,
Wes
Gary''s Student - 30 May 2008 17:46 GMT
Sub whereAmI()
MsgBox (ActiveCell.Top & Chr(10) & ActiveCell.Left)
End Sub
Note that if you select A1 you get 0,0
So it is relative to the top of the shorksheet, not the top of the
application.

Signature
Gary''s Student - gsnu2007i
> How can I find the x-y coordinates of the upper-left corner of a cell?
>
[quoted text clipped - 5 lines]
> Thanks,
> Wes
Sun Tzu - 30 May 2008 19:08 GMT
On May 30, 11:46 am, Gary''s Student
<GarysStud...@discussions.microsoft.com> wrote:
> Sub whereAmI()
> MsgBox (ActiveCell.Top & Chr(10) & ActiveCell.Left)
[quoted text clipped - 18 lines]
>
> - Show quoted text -
Thank you!
Peter T - 30 May 2008 17:47 GMT
Sub test()
Dim rng As Range
Dim shp As Shape
Set rng = Range("B2:D3")
With rng
Set shp = ActiveSheet.Shapes.AddShape( _
msoShapeRectangle, _
.Left, .Top, .Width, .Height)
End With
shp.Fill.ForeColor.SchemeColor = 7 + 6
End Sub
Regards,
Peter T
> How can I find the x-y coordinates of the upper-left corner of a cell?
>
[quoted text clipped - 5 lines]
> Thanks,
> Wes
Sun Tzu - 30 May 2008 19:04 GMT
> Sub test()
> Dim rng As Range
[quoted text clipped - 25 lines]
>
> - Show quoted text -
Thank you!