PC Review


Reply
Thread Tools Rate Thread

copy values from range of columns

 
 
louie
Guest
Posts: n/a
 
      30th Oct 2008
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 With Quote
 
 
 
 
Mike H
Guest
Posts: n/a
 
      30th Oct 2008
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 With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sum values in columns based on values in named range Mikael Andersson Microsoft Excel Worksheet Functions 10 12th Nov 2008 09:37 AM
Copy columns values into separate columns =?Utf-8?B?TWlrZV9jYW4=?= Microsoft Excel Misc 7 27th May 2006 12:32 AM
Counting Values in a Range of Columns =?Utf-8?B?RGlhbmVT?= Microsoft Access Getting Started 7 9th Apr 2006 04:04 AM
Range COPY function - how to copy VALUES and not formulas James Cooke Microsoft Excel Programming 1 21st Aug 2003 07:04 PM
Range COPY function - how to copy VALUES and not formulas James Cooke Microsoft Excel Worksheet Functions 1 21st Aug 2003 07:04 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:02 PM.