ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy variable sized range to single column... (https://www.excelbanter.com/excel-programming/383711-copy-variable-sized-range-single-column.html)

Jed

Copy variable sized range to single column...
 
Hello,

I have users selecting a range which I'm using on another spreadsheet, but I
need a way to have all of the cells, wherever they come from copied over into
one single column where they can be sorted, formatted etc.

How can I do this in VBA? Any suggestions would be very welcome.

Thanks in advance,
Jed

dkinn

Copy variable sized range to single column...
 
Hi Jed;

Here is one way to copy a selection to a single column

Sub Copytest()
'Copies from current selection
Cnt = Selection.Cells.Count
'My other workbook
With Workbooks("Book2").Worksheets("Sheet1")

For Item = 1 To Cnt
'Pastes to 2nd workbook
Selection.Cells(Item).Copy .Cells(Item, "A")
Next Item
End With
End Sub


hope this helps

David

"Jed" wrote:

Hello,

I have users selecting a range which I'm using on another spreadsheet, but I
need a way to have all of the cells, wherever they come from copied over into
one single column where they can be sorted, formatted etc.

How can I do this in VBA? Any suggestions would be very welcome.

Thanks in advance,
Jed



All times are GMT +1. The time now is 11:45 PM.

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