By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,650 Members | 753 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,650 IT Pros & Developers. It's quick & easy.

Address of Top Left Cell

P: 18
Is there a quick way to determine the address of the top left cell of the current selection in an excell spreadsheet?

Expand|Select|Wrap|Line Numbers
  1. Selection.Address
yields the address of the entire selection, which is not what I want. I could of course extract the required information from there (discard everything after the ":"), but that seems a roundabout way.

Thanks

EB
Jun 25 '08 #1
Share this Question
Share on Google+
2 Replies


kadghar
Expert 100+
P: 1,295
Hi,

selection.row
selection.column

might be of help, e.g.

Expand|Select|Wrap|Line Numbers
  1. Sub MyAdress()
  2. MsgBox "Column: " & Selection.Column & Chr(13) & "Row: " & Selection.Row
  3. End Sub
HTH

(btw, this is my 1000th post here ^.^)
Jun 25 '08 #2

P: 18
Thanks! I used your idea to create the following function:

Expand|Select|Wrap|Line Numbers
  1. Function TopLeftAddress()
  2.     TopLeftAddress = Range("A1").Offset(Selection.Row - 1, Selection.Column - 1).Address
  3. End Function
  4.  
  5. Sub Test()
  6.     MsgBox TopLeftAddress
  7. End Sub
EB
Jun 26 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.