Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding the position of a cell (in points)

Status
Not open for further replies.

Stretchwickster

Programmer
Apr 30, 2001
1,746
GB
I've written some code to add a textbox to a sheet. What I would like to do is find out the position in points (i.e. the top and left coordinates) of a given cell. This will allow me to correctly position the textbox, because it will not always be placed in the same position on the sheet.

Any input would be much appreciated!

Clive [infinity]
Ex nihilo, nihil fit (Out of nothing, nothing comes)
 
Hi, Clive: Just read the .Top and .Left properties of the cell (as a Range Object).
[blue]
Code:
Sub WhereAmI()
  With Range("B2")
    MsgBox "Top=" & .Top & "  Left=" & .Left
  End With
End Sub
[/color]

 
Zathras,
Sorry for wasting your time. I posted this and within a few minutes found the answer. So I posted up the answer in this thread then marked the thread as an inappropriate cos I thought it was a lazy post (in hindsight) as I hadn't looked in the VBA help properly. However, it seems that only my reply was removed and not the entire thread! And now I realise that the "Inappropriate post? If so, Red Flag it!" is designed for each individual post and not the whole thread - oops! I think the humid weather is getting to my brain - aaagggghhh!!

Thanks for your reply anyway!

Clive [infinity]
Ex nihilo, nihil fit (Out of nothing, nothing comes)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top