Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
copy values from range of columns
hello. i need some help. how do i copy values from range of columns ex. AA:AI
of sheet1 to D3:K3 of sheet2 with an interval of 6? i used the for loop, ex. for x = 1 to y step 6 but it didnt work. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
copy values from range of columns
Hi,
Your 2 ranges are different sizes. AA:AI wont fit into D3:K3 but I assume that's a typo. Right click sheet 1 tab, view code and paste this in and run it. Sub sonic() Dim MyRange Dim copyrange As Range lastrow = Cells(Cells.Rows.Count, "AA").End(xlUp).Row For x = 1 To lastrow Step 6 If copyrange Is Nothing Then Set copyrange = Cells(x, "AA").Resize(, 8) Else Set copyrange = Union(copyrange, Cells(x, "AA").Resize(, 8)) End If Next If Not copyrange Is Nothing Then copyrange.Copy Sheets("Sheet2").Range("D3") End If End Sub Mike "louie" wrote: hello. i need some help. how do i copy values from range of columns ex. AA:AI of sheet1 to D3:K3 of sheet2 with an interval of 6? i used the for loop, ex. for x = 1 to y step 6 but it didnt work. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Sum values in columns based on values in named range | Excel Worksheet Functions | |||
copy values in rows to columns | Excel Programming | |||
Macro to copy columns values | Excel Programming | |||
Copy columns values into separate columns | Excel Discussion (Misc queries) | |||
Range COPY function - how to copy VALUES and not formulas | Excel Programming |