Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default How can I "Select a range"

Dear users of the news group, I will try my best to describe my problem

I want to write a macro whose NAME is MY_MACRO which will be called
after I have selected a certain range in a ExcelSheet, say [B5:D10].
This Macro will have to proceed the data contained in the range.

My question is how can I access this range? Is this ActiveRange object?

Best regards
XS

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default How can I "Select a range"

Sub MY_MACRO()

With Selection
'do your stuff
End With

End Sub

--

HTH

RP
(remove nothere from the email address if mailing direct)


wrote in message
oups.com...
Dear users of the news group, I will try my best to describe my problem

I want to write a macro whose NAME is MY_MACRO which will be called
after I have selected a certain range in a ExcelSheet, say [B5:D10].
This Macro will have to proceed the data contained in the range.

My question is how can I access this range? Is this ActiveRange object?

Best regards
XS



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default How can I "Select a range"

do you know how can I copy this selected region and paste it exactly as
it is seen to a Outlook application?
XS

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How can I "Select a range"

Ron de Bruin's site

http://www.rondebruin.nl/sendmail.htm

--
Regards,
Tom Ogilvy


wrote in message
oups.com...
do you know how can I copy this selected region and paste it exactly as
it is seen to a Outlook application?
XS



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How can I "Select a range"

selection

for example

If typename(selection) = "Range" then
msgbox Selection.Address(external:=True)
End If
--
Regards,
Tom Ogilvy
wrote in message
oups.com...
Dear users of the news group, I will try my best to describe my problem

I want to write a macro whose NAME is MY_MACRO which will be called
after I have selected a certain range in a ExcelSheet, say [B5:D10].
This Macro will have to proceed the data contained in the range.

My question is how can I access this range? Is this ActiveRange object?

Best regards
XS





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default How can I "Select a range"

Dear Tom and Bob
Because my Selection is a Range, I would like to have another question:
how can I access the left most, top cell of the range, and how can I
use RELATIVE reference to access other cells from this top left most
cell.
Best regards.
XS

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default How can I "Select a range"


Selection.Cells(1,1)

is the top-left cell

selection.cells(1,1).cells(10,10).select

is one example that gets 10 rows, 10 columns off that cell, or

Selection.Cells(1,1).Offset(11,11).Select

does exactly the same using OFFSET.

And finally, here is a neat little trick I saw Tom post a while back

selection(selection.count).select

which gets the last cell in a selection.

--

HTH

RP
(remove nothere from the email address if mailing direct)


wrote in message
oups.com...
Dear Tom and Bob
Because my Selection is a Range, I would like to have another question:
how can I access the left most, top cell of the range, and how can I
use RELATIVE reference to access other cells from this top left most
cell.
Best regards.
XS



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
"Select method of Range class failed" Error Ayo Excel Discussion (Misc queries) 3 September 2nd 08 07:58 PM
How do I select a range of cells without doing Range("a3", "f3").. Miriam Excel Programming 2 December 20th 04 11:30 PM
VBA error 1004 "Select method of Range class failed" Matt J Excel Programming 6 July 3rd 04 10:05 PM
Using "Cells" to write "Range("A:A,H:H").Select" Trip Ives[_2_] Excel Programming 3 June 5th 04 03:13 PM
Error 1004, "select method of range class failed" paritoshmehta[_11_] Excel Programming 3 May 6th 04 10:09 PM


All times are GMT +1. The time now is 08:27 PM.

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

About Us

"It's about Microsoft Excel"