Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.office.developer.vba,microsoft.public.excel.programming
|
|||
|
|||
Copy entire columns starting from a certain cell down
I need a code that will copy an entire column, such as column A, but
not starting in cell A1. I would like to copy all cells beginning in A7 down to the last cell used in column A and then I will paste to a different sheet. I will be doing this with several different columns, not just column A, but all columns will start and end in the same rows, but the number of rows used will vary from month to month. I may have 10 rows one month, but 1000 the next. Any help is much appreciated! |
#2
Posted to microsoft.public.excel.programming,microsoft.public.office.developer.vba
|
|||
|
|||
Copy entire columns starting from a certain cell down
This copies columns A, G, I , V
Dim v as Variant, col as Long v = Array(0,6,8,21) ' A, G, I, V col = 1 set rng = Range(Cells(7,1),Cells(rows.count,1).End(xlup)) for i = lbound(v) to ubound(v) rng.offset(,v(i)).copy Destination:= _ worksheets("sheet2").Cells(1,col) col = col + 1 Next -- Regards, Tom Ogilvy "cheeser83" wrote: I need a code that will copy an entire column, such as column A, but not starting in cell A1. I would like to copy all cells beginning in A7 down to the last cell used in column A and then I will paste to a different sheet. I will be doing this with several different columns, not just column A, but all columns will start and end in the same rows, but the number of rows used will vary from month to month. I may have 10 rows one month, but 1000 the next. Any help is much appreciated! |
#3
Posted to microsoft.public.excel.programming,microsoft.public.office.developer.vba
|
|||
|
|||
Copy entire columns starting from a certain cell down
Thank you for the code. I am trying to decipher it as best I can. I
have a medium understanding of VBA. What part of the code is telling it where to paste? I would like to be able to change it to paste in a different area. For example, what it copies our of column A on sheet 1, I want to paste it to column B starting in row 7. Thank you very much for your help. Tom Ogilvy wrote: This copies columns A, G, I , V Dim v as Variant, col as Long v = Array(0,6,8,21) ' A, G, I, V col = 1 set rng = Range(Cells(7,1),Cells(rows.count,1).End(xlup)) for i = lbound(v) to ubound(v) rng.offset(,v(i)).copy Destination:= _ worksheets("sheet2").Cells(1,col) col = col + 1 Next -- Regards, Tom Ogilvy "cheeser83" wrote: I need a code that will copy an entire column, such as column A, but not starting in cell A1. I would like to copy all cells beginning in A7 down to the last cell used in column A and then I will paste to a different sheet. I will be doing this with several different columns, not just column A, but all columns will start and end in the same rows, but the number of rows used will vary from month to month. I may have 10 rows one month, but 1000 the next. Any help is much appreciated! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
copy entire row, not just cell in row | Excel Programming | |||
How to indicate in formula to choose the entire column starting from a specified cell? | Excel Discussion (Misc queries) | |||
Getting macro to copy to starting cell | Excel Worksheet Functions | |||
Copy one cell to entire column | Excel Discussion (Misc queries) | |||
Copy one cell to entire column | Excel Discussion (Misc queries) |