#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default Copy Cells

After importing rows into Excel, I need to copy the values only of column P
into the same row in column AA, but only if column P has not yet been copied
(only newly appended rows). I've tried many ways unsuccessfully. I'd
appreciate any guidance. Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Copy Cells

This might work:

Sub CpyMaybe()
lr = Cells(Rows.Count, 16).End(xlUP).Row
For i = 1 To lr 'Assumes no header, change AR
If Cells(i, 16) < Cells(i, 27) Then
Cells(i, 16).Copy Cells(i, 27)
End If
Next
End Sub

"Alex" wrote:

After importing rows into Excel, I need to copy the values only of column P
into the same row in column AA, but only if column P has not yet been copied
(only newly appended rows). I've tried many ways unsuccessfully. I'd
appreciate any guidance. Thanks.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default Copy Cells

it works, but how can I put pastevalues only in the code?

"JLGWhiz" wrote:

This might work:

Sub CpyMaybe()
lr = Cells(Rows.Count, 16).End(xlUP).Row
For i = 1 To lr 'Assumes no header, change AR
If Cells(i, 16) < Cells(i, 27) Then
Cells(i, 16).Copy Cells(i, 27)
End If
Next
End Sub

"Alex" wrote:

After importing rows into Excel, I need to copy the values only of column P
into the same row in column AA, but only if column P has not yet been copied
(only newly appended rows). I've tried many ways unsuccessfully. I'd
appreciate any guidance. Thanks.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Copy Cells

Cells(i, 16).Copy Cells(i, 27)

This line copies and pastes in one action. What other paste do you want to
do.
Maybe I didn't understand the question.

"Alex" wrote:

it works, but how can I put pastevalues only in the code?

"JLGWhiz" wrote:

This might work:

Sub CpyMaybe()
lr = Cells(Rows.Count, 16).End(xlUP).Row
For i = 1 To lr 'Assumes no header, change AR
If Cells(i, 16) < Cells(i, 27) Then
Cells(i, 16).Copy Cells(i, 27)
End If
Next
End Sub

"Alex" wrote:

After importing rows into Excel, I need to copy the values only of column P
into the same row in column AA, but only if column P has not yet been copied
(only newly appended rows). I've tried many ways unsuccessfully. I'd
appreciate any guidance. Thanks.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Copy Cells

Ok, I think I understand the problem now. Try this.

Sub CpyMaybe()
lr = Cells(Rows.Count, 16).End(xlUP).Row
For i = 1 To lr 'Assumes no header, change AR
If Cells(i, 16) < Cells(i, 27) Then
Cells(i, 16).Copy
Cells(i, 27).PasteSpecial Paste:=xlValues
End If
Next
End Sub

"Alex" wrote:

it works, but how can I put pastevalues only in the code?

"JLGWhiz" wrote:

This might work:

Sub CpyMaybe()
lr = Cells(Rows.Count, 16).End(xlUP).Row
For i = 1 To lr 'Assumes no header, change AR
If Cells(i, 16) < Cells(i, 27) Then
Cells(i, 16).Copy Cells(i, 27)
End If
Next
End Sub

"Alex" wrote:

After importing rows into Excel, I need to copy the values only of column P
into the same row in column AA, but only if column P has not yet been copied
(only newly appended rows). I've tried many ways unsuccessfully. I'd
appreciate any guidance. Thanks.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default Copy Cells

Yes, pefect. Thanks so much.

"JLGWhiz" wrote:

Ok, I think I understand the problem now. Try this.

Sub CpyMaybe()
lr = Cells(Rows.Count, 16).End(xlUP).Row
For i = 1 To lr 'Assumes no header, change AR
If Cells(i, 16) < Cells(i, 27) Then
Cells(i, 16).Copy
Cells(i, 27).PasteSpecial Paste:=xlValues
End If
Next
End Sub

"Alex" wrote:

it works, but how can I put pastevalues only in the code?

"JLGWhiz" wrote:

This might work:

Sub CpyMaybe()
lr = Cells(Rows.Count, 16).End(xlUP).Row
For i = 1 To lr 'Assumes no header, change AR
If Cells(i, 16) < Cells(i, 27) Then
Cells(i, 16).Copy Cells(i, 27)
End If
Next
End Sub

"Alex" wrote:

After importing rows into Excel, I need to copy the values only of column P
into the same row in column AA, but only if column P has not yet been copied
(only newly appended rows). I've tried many ways unsuccessfully. I'd
appreciate any guidance. Thanks.

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
How can I copy big ranges of cells without drag or copy/paste? Ricardo Julio Excel Discussion (Misc queries) 3 March 23rd 10 02:38 PM
Copy and paste versus copy and insert copied cells Alana New Users to Excel 1 September 28th 07 08:58 PM
macro needed to copy blocks of cells across to list of cells down piersonpro Excel Programming 3 March 28th 07 12:51 PM
Copy/Paste how to avoid the copy of formula cells w/o calc values Dennis Excel Discussion (Misc queries) 10 March 2nd 06 10:47 PM
Copy data into cells until changes trigger new copy mdeanda Excel Programming 2 April 25th 05 01:32 PM


All times are GMT +1. The time now is 05:15 AM.

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"