Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / May 2008

Tip: Looking for answers? Try searching our database.

Find x-y coordinates of cell?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sun Tzu - 30 May 2008 17:21 GMT
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!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.