Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 112
Default Extending a range selection

Id like to extend the range selection of the CURRENT row from A column to 2
(adjacent) rows until End(xlRight) and then copy the selection
I dont seem to get it right having selected 2 rows and trying to extend the
selection until End(xlRight). Can anybody help with the syntax, please?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Extending a range selection

hi
if i understand you correctly, you are somewhere in A column and want to
select 2 rows down and to the end of the data. Assuming you have a solid
block of data, try this....
Range(ActiveCell, ActiveCell.Offset(2, 0).End(xlToRight)).Select

regards
FSt1

"Mats Samson" wrote:

Id like to extend the range selection of the CURRENT row from A column to 2
(adjacent) rows until End(xlRight) and then copy the selection
I dont seem to get it right having selected 2 rows and trying to extend the
selection until End(xlRight). Can anybody help with the syntax, please?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 112
Default Extending a range selection

Thanks FSt1,
well not exactly, I wanted to select 2 rows and copy them.
However, meanwhile I solved it:
Selection.End(xlToLeft).Range("A1:A2").Select
Range(Selection, Selection.End(xlToRight)).Copy

Thanks anyway
Mats

"FSt1" wrote:

hi
if i understand you correctly, you are somewhere in A column and want to
select 2 rows down and to the end of the data. Assuming you have a solid
block of data, try this....
Range(ActiveCell, ActiveCell.Offset(2, 0).End(xlToRight)).Select

regards
FSt1

"Mats Samson" wrote:

Id like to extend the range selection of the CURRENT row from A column to 2
(adjacent) rows until End(xlRight) and then copy the selection
I dont seem to get it right having selected 2 rows and trying to extend the
selection until End(xlRight). Can anybody help with the syntax, please?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Extending a range selection

hi
how about this to select only 2 rows.....
Range(ActiveCell, ActiveCell.Offset(1, 0).End(xlToRight)).Select

regards
FSt1

"Mats Samson" wrote:

Thanks FSt1,
well not exactly, I wanted to select 2 rows and copy them.
However, meanwhile I solved it:
Selection.End(xlToLeft).Range("A1:A2").Select
Range(Selection, Selection.End(xlToRight)).Copy

Thanks anyway
Mats

"FSt1" wrote:

hi
if i understand you correctly, you are somewhere in A column and want to
select 2 rows down and to the end of the data. Assuming you have a solid
block of data, try this....
Range(ActiveCell, ActiveCell.Offset(2, 0).End(xlToRight)).Select

regards
FSt1

"Mats Samson" wrote:

Id like to extend the range selection of the CURRENT row from A column to 2
(adjacent) rows until End(xlRight) and then copy the selection
I dont seem to get it right having selected 2 rows and trying to extend the
selection until End(xlRight). Can anybody help with the syntax, please?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 112
Default Extending a range selection

I prefer my solution as I can start from any column, and the procedure
move leftwards to get the first column and then extends the range to 2 rows
and rightwards to the end of data.
Cheers
Mats

"FSt1" wrote:

hi
how about this to select only 2 rows.....
Range(ActiveCell, ActiveCell.Offset(1, 0).End(xlToRight)).Select

regards
FSt1

"Mats Samson" wrote:

Thanks FSt1,
well not exactly, I wanted to select 2 rows and copy them.
However, meanwhile I solved it:
Selection.End(xlToLeft).Range("A1:A2").Select
Range(Selection, Selection.End(xlToRight)).Copy

Thanks anyway
Mats

"FSt1" wrote:

hi
if i understand you correctly, you are somewhere in A column and want to
select 2 rows down and to the end of the data. Assuming you have a solid
block of data, try this....
Range(ActiveCell, ActiveCell.Offset(2, 0).End(xlToRight)).Select

regards
FSt1

"Mats Samson" wrote:

Id like to extend the range selection of the CURRENT row from A column to 2
(adjacent) rows until End(xlRight) and then copy the selection
I dont seem to get it right having selected 2 rows and trying to extend the
selection until End(xlRight). Can anybody help with the syntax, please?



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Extending a range selection

Hi Mats

I think this is what you are looking for:

Range(Cells(ActiveCell.Row, 1), ActiveCell.End(xlToRight).Offset(1, 0)).Copy

Regards,
Per

"Mats Samson" skrev i meddelelsen
...
Thanks FSt1,
well not exactly, I wanted to select 2 rows and copy them.
However, meanwhile I solved it:
Selection.End(xlToLeft).Range("A1:A2").Select
Range(Selection, Selection.End(xlToRight)).Copy

Thanks anyway
Mats

"FSt1" wrote:

hi
if i understand you correctly, you are somewhere in A column and want to
select 2 rows down and to the end of the data. Assuming you have a solid
block of data, try this....
Range(ActiveCell, ActiveCell.Offset(2, 0).End(xlToRight)).Select

regards
FSt1

"Mats Samson" wrote:

Id like to extend the range selection of the CURRENT row from A column
to 2
(adjacent) rows until End(xlRight) and then copy the selection
I dont seem to get it right having selected 2 rows and trying to
extend the
selection until End(xlRight). Can anybody help with the syntax, please?


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Extending a range selection

I think this code also does what you want...

With Selection
.End(xlToLeft).Resize(2, .End(xlToRight).Column - ..End(xlToLeft).Column + 1).Copy
End With

Rick


"Mats Samson" wrote in message ...
Thanks FSt1,
well not exactly, I wanted to select 2 rows and copy them.
However, meanwhile I solved it:
Selection.End(xlToLeft).Range("A1:A2").Select
Range(Selection, Selection.End(xlToRight)).Copy

Thanks anyway
Mats

"FSt1" wrote:

hi
if i understand you correctly, you are somewhere in A column and want to
select 2 rows down and to the end of the data. Assuming you have a solid
block of data, try this....
Range(ActiveCell, ActiveCell.Offset(2, 0).End(xlToRight)).Select

regards
FSt1

"Mats Samson" wrote:

Id like to extend the range selection of the CURRENT row from A column to 2
(adjacent) rows until End(xlRight) and then copy the selection
I dont seem to get it right having selected 2 rows and trying to extend the
selection until End(xlRight). Can anybody help with the syntax, please?

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 112
Default Extending a range selection

Thanks guys,
there seems to be lots of alternatives to this.
I like Pers option as it's accomplished in one row! Neat!
But Rick, what shall be in place of -. after .Column?
Best regards
Mats

"Rick Rothstein (MVP - VB)" wrote:

I think this code also does what you want...

With Selection
.End(xlToLeft).Resize(2, .End(xlToRight).Column - ..End(xlToLeft).Column + 1).Copy
End With

Rick


"Mats Samson" wrote in message ...
Thanks FSt1,
well not exactly, I wanted to select 2 rows and copy them.
However, meanwhile I solved it:
Selection.End(xlToLeft).Range("A1:A2").Select
Range(Selection, Selection.End(xlToRight)).Copy

Thanks anyway
Mats

"FSt1" wrote:

hi
if i understand you correctly, you are somewhere in A column and want to
select 2 rows down and to the end of the data. Assuming you have a solid
block of data, try this....
Range(ActiveCell, ActiveCell.Offset(2, 0).End(xlToRight)).Select

regards
FSt1

"Mats Samson" wrote:

Id like to extend the range selection of the CURRENT row from A column to 2
(adjacent) rows until End(xlRight) and then copy the selection
I dont seem to get it right having selected 2 rows and trying to extend the
selection until End(xlRight). Can anybody help with the syntax, please?


  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Extending a range selection

I'm not sure I understand your question to me... there is something already
after the dash. Just in case you asked your question because what I posted
got cut-off in some way, here is the code again, but this time I used a line
continuation character to show the single-line statement on two lines (you
can combine it back into a single line after copy/pasting it into your
program)...

With Selection
.End(xlToLeft).Resize(2, .End(xlToRight).Column - _
.End(xlToLeft).Column + 1).Copy
End With

Rick


"Mats Samson" wrote in message
...
Thanks guys,
there seems to be lots of alternatives to this.
I like Pers option as it's accomplished in one row! Neat!
But Rick, what shall be in place of -. after .Column?
Best regards
Mats

"Rick Rothstein (MVP - VB)" wrote:

I think this code also does what you want...

With Selection
.End(xlToLeft).Resize(2, .End(xlToRight).Column -
..End(xlToLeft).Column + 1).Copy
End With

Rick


"Mats Samson" wrote in message
...
Thanks FSt1,
well not exactly, I wanted to select 2 rows and copy them.
However, meanwhile I solved it:
Selection.End(xlToLeft).Range("A1:A2").Select
Range(Selection, Selection.End(xlToRight)).Copy

Thanks anyway
Mats

"FSt1" wrote:

hi
if i understand you correctly, you are somewhere in A column and want
to
select 2 rows down and to the end of the data. Assuming you have a
solid
block of data, try this....
Range(ActiveCell, ActiveCell.Offset(2, 0).End(xlToRight)).Select

regards
FSt1

"Mats Samson" wrote:

Id like to extend the range selection of the CURRENT row from A
column to 2
(adjacent) rows until End(xlRight) and then copy the selection
I dont seem to get it right having selected 2 rows and trying to
extend the
selection until End(xlRight). Can anybody help with the syntax,
please?



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
Extending a range Macca1984 Excel Discussion (Misc queries) 5 March 6th 08 11:36 AM
Extending a range Macca1984 Excel Programming 0 March 5th 08 09:58 PM
Extending Sort Range Millington Excel Worksheet Functions 0 October 14th 07 03:24 PM
extending selection Flip Excel Discussion (Misc queries) 5 April 5th 05 11:17 AM
Extending Selection Philip[_6_] Excel Programming 3 June 8th 04 08:42 PM


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