Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Extending a range | Excel Discussion (Misc queries) | |||
Extending a range | Excel Programming | |||
Extending Sort Range | Excel Worksheet Functions | |||
extending selection | Excel Discussion (Misc queries) | |||
Extending Selection | Excel Programming |