Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
AK AK is offline
external usenet poster
 
Posts: 56
Default Last cell, copy, paste special, loop

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Last cell, copy, paste special, loop

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
--
Gary's Student
gsnu200704


"AK" wrote:

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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default Last cell, copy, paste special, loop

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
"AK" wrote in message
...
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




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
Copy and Paste Special (Formulas) pastes cell value if numeric [email protected] Excel Discussion (Misc queries) 2 May 2nd 06 06:24 PM
For next loop and paste special Help please mrdata[_20_] Excel Programming 7 April 14th 06 02:52 AM
Create new sheet from cell-info and then copy/paste special Ingve Excel Programming 0 January 19th 06 10:58 PM
Copy Paste Special Link Cell Problem cpetta Links and Linking in Excel 6 July 2nd 05 12:58 AM
Dynamic Copy/Paste Special Formulas/Paste Special Values Sharon Perez Excel Programming 3 August 7th 04 09:49 PM


All times are GMT +1. The time now is 09:48 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"