Copy every 10th cell in columns A and C to a new worksheet

bradyj7

Board Regular
Joined
Mar 2, 2011
Messages
106
Hi there,

I have values in two columns A and C. I need to write a macro to copy the values in every 10th cell in both columns to a new worksheet. The first value in column A that I would like to copy is in row 29. So the subsequent values are in rows 39,49,59 etc. In column c, the first value is in row 35. So the subsequent values are in rows 45,55,65 etc. The number of rows is varies.

Thanks in advance for the help.
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Try

Code:
Sub Copy10()
Dim LR As Long, i As Long, ws As Worksheet
Set ws = ActiveSheet
Worksheets.Add
With ws
    LR = .Range("A" & Rows.Count).End(xlUp).Row
    For i = 29 To LR Step 10
        .Range("A" & i).Copy Destination = Range("A" & Rows.Count).End(xlUp).Offset(1)
    Next i
    LR = .Range("C" & Rows.Count).End(xlUp).Row
    For i = 35 To LR Step 10
        .Range("A" & i).Copy Destination = Range("B" & Rows.Count).End(xlUp).Offset(1)
    Next i
End With
End Sub
 
Upvote 0
Hi thanks for the reply,

I'm getting this error 'copy method or range class failed" on this line
Code:
.Range("A" & i).Copy Destination = Range("A" & Rows.Count).End(xlUp).Offset(1)

thank you
 
Upvote 0
Sorry:

Rich (BB code):
Sub Copy10()
Dim LR As Long, i As Long, ws As Worksheet
Set ws = ActiveSheet
Worksheets.Add
With ws
    LR = .Range("A" & Rows.Count).End(xlUp).Row
    For i = 29 To LR Step 10
        .Range("A" & i).Copy Destination:=Range("A" & Rows.Count).End(xlUp).Offset(1)
    Next i
    LR = .Range("C" & Rows.Count).End(xlUp).Row
    For i = 35 To LR Step 10
        .Range("A" & i).Copy Destination:=Range("B" & Rows.Count).End(xlUp).Offset(1)
    Next i
End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,595
Messages
6,179,798
Members
452,943
Latest member
Newbie4296

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top