![]() |
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. |
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. |
All times are GMT +1. The time now is 05:46 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com