ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How can I "Select a range" (https://www.excelbanter.com/excel-programming/325308-how-can-i-select-range.html)

[email protected]

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


Bob Phillips[_6_]

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




Tom Ogilvy

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




[email protected]

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


Tom Ogilvy

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




[email protected]

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


Bob Phillips[_6_]

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





All times are GMT +1. The time now is 05:07 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com