Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Finding and pasting over a row

Hi, hope someone might be able to help me.....

I have data in rows on sheet 1 where column A is the unique referenc
and am pulling a single row of that data into sheet2 via VLOOKUP an
altering some of it.
I then want to copy the entire row in sheet2, and find the location o
the original row in sheet1 based on the unique reference and paste th
new values over the top of that row.

Make sense? It's obviously part of a much larger project, but I'
kinda stuck at this stage. Your help would be greatly appriciated.

Regards,

Chris

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Finding and pasting over a row

Dim rng1 as Range, rng2 as Range
Dim cell1 as Range, cell2 as Range
Dim res as Variant
' set source range
With worksheets("Sheet1")
set rng1 = .Range(.Cells(1,1),.Cells(rows.count,1).End(xlup))
End With
' set range on sheet2
With worksheets("Sheet2")
set rng2 = .Range(.Cells(1,1),.Cells(rows.count,1).End(xlup))
End With

for each cell2 in rng2
res = application.Match(cell2.value,rng1,0)
if not iserror(res) then
set cell1 = rng1(res)
cell2.entireRow.Copy
cell1.Pastespecial xlValues
end if
Next

--
Regards,
Tom Ogilvy

"Big Chris " wrote in message
...
Hi, hope someone might be able to help me.....

I have data in rows on sheet 1 where column A is the unique reference
and am pulling a single row of that data into sheet2 via VLOOKUP and
altering some of it.
I then want to copy the entire row in sheet2, and find the location of
the original row in sheet1 based on the unique reference and paste the
new values over the top of that row.

Make sense? It's obviously part of a much larger project, but I'm
kinda stuck at this stage. Your help would be greatly appriciated.

Regards,

Chris.


---
Message posted from http://www.ExcelForum.com/



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-pasting a cell and finding lows and highs Fisherman Excel Discussion (Misc queries) 0 September 14th 09 11:45 PM
Finding a match and pasting next to it Donna S Excel Discussion (Misc queries) 2 November 16th 06 07:34 PM
Pasting on Filtered Data Sheets without pasting onto hidden cells CCSMCA Excel Discussion (Misc queries) 1 August 28th 05 01:22 PM
Pasting numbers and formulas without pasting format. Dan Excel Discussion (Misc queries) 3 March 27th 05 03:47 AM
Finding a range for Copying & Pasting John R[_3_] Excel Programming 1 August 19th 03 03:54 PM


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