ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy every 3rd cell, define destination range for paste (https://www.excelbanter.com/excel-programming/373807-copy-every-3rd-cell-define-destination-range-paste.html)

Meltad

Copy every 3rd cell, define destination range for paste
 
Hi all,

I'm trying to copy every third cell of column c starting at C16, and paste
into column C of the next blank row of a separate workbook. This code below
kind of works but it errors where I've defined the 'pasterange' in the other
workbook (I think this is incorrect but you know what I'm trying to
achieve!). Can anyone help?? :-) Also I don't know how to set the code to
copy from C16 to nrows - if it copies from the bottom i need to go up a row,
copy that, then copy every 3rd. Column C looks like this...

35467 <---- (Row 16)
text 1
BLANK
84950
text 2
BLANK
24967
text 3
BLANK

I need all the numbers... Code below

Dim pasterange As Range
Dim i As Long
Set pasterange =
Windows("LFmacro.XLS").Sheets("Report").Range("A65 536").End(xlUp).Offset(2)
LastRow = Cells(Rows.Count, 3).End(xlUp).Row
For i = 1 To LastRow Step 2
pasterange = Cells(i, 1)
Next i

Don Guillett

Copy every 3rd cell, define destination range for paste
 
See your ORIGINAL thread

--
Don Guillett
SalesAid Software

"Meltad" wrote in message
...
Hi all,

I'm trying to copy every third cell of column c starting at C16, and paste
into column C of the next blank row of a separate workbook. This code
below
kind of works but it errors where I've defined the 'pasterange' in the
other
workbook (I think this is incorrect but you know what I'm trying to
achieve!). Can anyone help?? :-) Also I don't know how to set the code to
copy from C16 to nrows - if it copies from the bottom i need to go up a
row,
copy that, then copy every 3rd. Column C looks like this...

35467 <---- (Row 16)
text 1
BLANK
84950
text 2
BLANK
24967
text 3
BLANK

I need all the numbers... Code below

Dim pasterange As Range
Dim i As Long
Set pasterange =
Windows("LFmacro.XLS").Sheets("Report").Range("A65 536").End(xlUp).Offset(2)
LastRow = Cells(Rows.Count, 3).End(xlUp).Row
For i = 1 To LastRow Step 2
pasterange = Cells(i, 1)
Next i





All times are GMT +1. The time now is 05:03 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com