Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sum values in columns based on values in named range Mikael Andersson Excel Worksheet Functions 10 November 12th 08 09:37 AM
copy values in rows to columns Carpe Diem Excel Programming 1 December 20th 06 09:43 PM
Macro to copy columns values Mike_can Excel Programming 1 May 29th 06 04:24 AM
Copy columns values into separate columns Mike_can Excel Discussion (Misc queries) 7 May 27th 06 12:32 AM
Range COPY function - how to copy VALUES and not formulas James Cooke Excel Programming 1 August 21st 03 07:04 PM


All times are GMT +1. The time now is 07:12 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"