Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How can I copy big ranges of cells without drag or copy/paste? | Excel Discussion (Misc queries) | |||
Copy and paste versus copy and insert copied cells | New Users to Excel | |||
macro needed to copy blocks of cells across to list of cells down | Excel Programming | |||
Copy/Paste how to avoid the copy of formula cells w/o calc values | Excel Discussion (Misc queries) | |||
Copy data into cells until changes trigger new copy | Excel Programming |