Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Getting Selected

If macro starts with a selected area (by mouse) how do you get the
corner cells of the selected area? In other words obtain the cell:cell form.

Thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Getting Selected


"John" wrote in message
...
If macro starts with a selected area (by mouse) how do you get the
corner cells of the selected area? In other words obtain the cell:cell

form.

Thanks


you need to use the AddressLocal property of the selected Range. So:

strTopLeft = Activesheet.Cells(Selection.Row, Selection.Column).AddressLocal
strBottomRight = Activesheet.Cells(Selection.Row+Selection.Rows.Cou nt-1,
Selection.Column+Selection.Columns.Count-1).AddressLocal

Iain King


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Getting Selected

dim myRng as range
set myRng = selection.areas(1)

msgbox myrng.cells(1).address
msgbox myrng.cells(myrng.cells.count).address


I used Areas(1) just in case you have more than one area selected.


John wrote:

If macro starts with a selected area (by mouse) how do you get the
corner cells of the selected area? In other words obtain the cell:cell form.

Thanks


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Getting Selected

oops, not quite finished :)

strTopLeft = Activesheet.Cells(Selection.Row,

Selection.Column).AddressLocal
strBottomRight = Activesheet.Cells(Selection.Row+Selection.Rows.Cou nt-1, _
Selection.Column+Selection.Columns.Count-1).AddressLocal


strSelectedRange = strTopLeft+":"+strBottomRight

Iain King


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Getting Selected

for a single area:

msgbox Selection.Address(0,0)

--
Regards,
Tom Ogilvy


"John" wrote in message
...
If macro starts with a selected area (by mouse) how do you get the
corner cells of the selected area? In other words obtain the cell:cell

form.

Thanks



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
Multiple cells or columns are selected instead of selected cell or Mikey Excel Discussion (Misc queries) 1 April 29th 09 09:48 PM
Cells are selected but aren't displayed as selected Nifty Excel Discussion (Misc queries) 2 September 17th 06 07:22 PM
Cells are selected but aren't displayed as selected Nifty Excel Worksheet Functions 0 September 17th 06 11:34 AM
A validated List which link to selected cells according to what is selected on the list WL Excel Worksheet Functions 1 June 5th 06 08:52 PM
how do i make it so that when a sheat is selected either via link or tab, that xlLastCell is selected. the last on the sheet. Daniel Excel Worksheet Functions 1 July 12th 05 01:30 AM


All times are GMT +1. The time now is 07:34 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"