Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Find x-y coordinates of cell?

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Find x-y coordinates of cell?

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.
--
Gary''s Student - gsnu2007i


"Sun Tzu" wrote:

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Find x-y coordinates of cell?

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

"Sun Tzu" wrote in message
...
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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Find x-y coordinates of cell?

On May 30, 11:47*am, "Peter T" <peter_t@discussions wrote:
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

"Sun Tzu" wrote in message

...



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- Hide quoted text -


- Show quoted text -


Thank you!
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Find x-y coordinates of cell?

On May 30, 11:46*am, Gary''s Student
wrote:
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.
--
Gary''s Student - gsnu2007i



"Sun Tzu" wrote:
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- Hide quoted text -


- Show quoted text -


Thank you!
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
find corresponding coordinates on graph KJ Charts and Charting in Excel 1 March 13th 09 01:51 PM
how to find coordinates in excel graph golden friend Charts and Charting in Excel 0 November 29th 06 12:29 PM
Find specific text and return coordinates BOONER Excel Programming 4 May 9th 06 09:42 PM
Simple way to convert UTM ED50 coordinates to decimal coordinates? Dan[_38_] Excel Programming 8 July 11th 04 04:54 PM
How to find the cell given x and y worksheet coordinates Stefano Gatto[_2_] Excel Programming 7 May 6th 04 03:17 AM


All times are GMT +1. The time now is 05:20 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"