Last cell, copy, paste special, loop

G

Guest

Need help with the following:

I have data (equations) in columns P and Q. I need to copy and paste
special values the values in P2 and Q2 to R2 and S2.

I know simple...
But there are a few thousand rows of data and the data in columns P and Q
are based on equations that change based on how far down the R column is
filled down.

Currently I have something like this..
Range("r1", Range("r1").End(xlDown)).Offset(2, -2).Resize(1, 2).Copy
Range("r1", Range("r1").End(xlDown)).Offset(2, 0).Resize(1, 2).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False

But it doesn't go to the next set of cells after the initial copy and paste.

I also need to Loop this process for all rows.

Thanks in advance
 
G

Guest

This goes from P2 down about 1000 rows. Adapt it to suit your needs:

Sub ak()
For i = 2 To 1000
Range("P" & i & ":Q" & i).Copy
Range("R" & i).PasteSpecial Paste:=xlPasteValues
Next
End Sub
 
M

Mike Fogleman

Sub CopyDown()
Dim LRow As Long, i As Long

Application.ScreenUpdating = False
LRow = Cells(Rows.Count, 16).End(xlUp).Row

For i = 2 To LRow
Range("P" & i & ":Q" & i).Copy
Range("R" & i).PasteSpecial Paste:=xlPasteValues
Next

Application.ScreenUpdating = True
End Sub

You could set calculation to Manual to speed things up, however your
description indicates that formulas need to calculate as column R fills up.

Mike F
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top