Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default first and last cells of manually selected regions

I'm writing a script to be run on manually selected regions in
different worksheets in the same workbook. (I'll select one region
at a time and then run the script.)

How do I programmatically find the first and last cells
(upper-left and bottom-right corners) of a manually selected
region? Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default first and last cells of manually selected regions


you can try these statements and see if they work for you

selection.range("A1").address

selection.specialcells(xlcelltypelastcell).address
--


Gary


"John Smith" wrote in message
...
I'm writing a script to be run on manually selected regions in
different worksheets in the same workbook. (I'll select one region
at a time and then run the script.)

How do I programmatically find the first and last cells
(upper-left and bottom-right corners) of a manually selected
region? Thanks.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default first and last cells of manually selected regions


Sub aaaa()
Dim rng As Range
Set rng = Selection.Cells
If rng.Areas.Count 1 Then
MsgBox "multiple selection"
Else
MsgBox rng(1).Address & vbCr & rng(rng.Count).Address
End If
Set rng = Nothing
End Sub
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



"John Smith"
wrote in message
I'm writing a script to be run on manually selected regions in
different worksheets in the same workbook. (I'll select one region
at a time and then run the script.)

How do I programmatically find the first and last cells
(upper-left and bottom-right corners) of a manually selected
region? Thanks.
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default first and last cells of manually selected regions

Are they single area ranges?

with selection
msgbox .cells(1).address & vblf & .cells(.cells.count).address
end with

John Smith wrote:

I'm writing a script to be run on manually selected regions in
different worksheets in the same workbook. (I'll select one region
at a time and then run the script.)

How do I programmatically find the first and last cells
(upper-left and bottom-right corners) of a manually selected
region? Thanks.


--

Dave Peterson
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
how to number cells (1,2,3...) w/o having to manually type them al Botkinmama Excel Worksheet Functions 2 March 30th 10 03:28 PM
manually selected Excel cell formatting TomCU Excel Discussion (Misc queries) 1 January 18th 10 12:58 PM
Multiple cells or columns are selected instead of selected cell or Mikey Excel Discussion (Misc queries) 1 April 29th 09 09:48 PM
Manually delete cells not being used at ends of workbook Woody13 Excel Discussion (Misc queries) 3 February 16th 06 12:02 AM
Linked cells, make the data go hard manually Johnny Excel Discussion (Misc queries) 1 May 11th 05 09:00 PM


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