PC Review


Reply
Thread Tools Rate Thread

copy no match

 
 
vernalGreens@gmail.com
Guest
Posts: n/a
 
      15th Dec 2006
sheet1

column A column B
R1
R2 ABC 10
R3 DEF 12
R4 LMN

sheet2
column A column B
R1
R2 ABC 9
R3 XYZ 13
R4 DEF 11
R5 PQR 15


I've to find out all the column A values of sheet2 that are not in
column A of sheet1 (in this example XYZ and PQR) and paste the entire
row of sheet 2 in the next null row under column B of sheet1. Since
null row under column B of sheet 1 is R4, R4 will be overwritten.

Thus the output will look like

sheet1
column A column B
R1
R2 ABC 10
R3 DEF 12
R4 XYZ 13
R5 PQR 15

 
Reply With Quote
 
 
 
 
ankur
Guest
Posts: n/a
 
      15th Dec 2006
Hi Vernal,

Try this...


Sub test()
On Error Resume Next
Dim S1 As Worksheet
Dim S2 As Worksheet
Dim cell As Object

Set S1 = Sheets("Sheet1")
Set S2 = Sheets("Sheet2")



For Each cell In S2.Range("B1:B" & S2.Range("B65536").End(xlUp).Row)
RowInS2 = 0
RowInS2 = S1.Columns("b:b").Find(what:=cell.Value,
lookat:=xlWhole).Row
If RowInS2 = 0 Then
S2.Rows(cell.Row).Copy
S1.Select
Range("C65536").End(xlUp).Offset(1, -2).Select
ActiveSheet.Paste
S2.Select
End If

Next cell

Application.CutCopyMode = False


End Sub

Regards
Ankur Kanchan
www.xlmacros.com




(E-Mail Removed) wrote:

> sheet1
>
> column A column B
> R1
> R2 ABC 10
> R3 DEF 12
> R4 LMN
>
> sheet2
> column A column B
> R1
> R2 ABC 9
> R3 XYZ 13
> R4 DEF 11
> R5 PQR 15
>
>
> I've to find out all the column A values of sheet2 that are not in
> column A of sheet1 (in this example XYZ and PQR) and paste the entire
> row of sheet 2 in the next null row under column B of sheet1. Since
> null row under column B of sheet 1 is R4, R4 will be overwritten.
>
> Thus the output will look like
>
> sheet1
> column A column B
> R1
> R2 ABC 10
> R3 DEF 12
> R4 XYZ 13
> R5 PQR 15


 
Reply With Quote
 
vernalGreens@gmail.com
Guest
Posts: n/a
 
      15th Dec 2006
works well. thanks.

ankur wrote:
> Hi Vernal,
>
> Try this...
>
>
> Sub test()
> On Error Resume Next
> Dim S1 As Worksheet
> Dim S2 As Worksheet
> Dim cell As Object
>
> Set S1 = Sheets("Sheet1")
> Set S2 = Sheets("Sheet2")
>
>
>
> For Each cell In S2.Range("B1:B" & S2.Range("B65536").End(xlUp).Row)
> RowInS2 = 0
> RowInS2 = S1.Columns("b:b").Find(what:=cell.Value,
> lookat:=xlWhole).Row
> If RowInS2 = 0 Then
> S2.Rows(cell.Row).Copy
> S1.Select
> Range("C65536").End(xlUp).Offset(1, -2).Select
> ActiveSheet.Paste
> S2.Select
> End If
>
> Next cell
>
> Application.CutCopyMode = False
>
>
> End Sub
>
> Regards
> Ankur Kanchan
> www.xlmacros.com
>
>
>
>
> (E-Mail Removed) wrote:
>
> > sheet1
> >
> > column A column B
> > R1
> > R2 ABC 10
> > R3 DEF 12
> > R4 LMN
> >
> > sheet2
> > column A column B
> > R1
> > R2 ABC 9
> > R3 XYZ 13
> > R4 DEF 11
> > R5 PQR 15
> >
> >
> > I've to find out all the column A values of sheet2 that are not in
> > column A of sheet1 (in this example XYZ and PQR) and paste the entire
> > row of sheet 2 in the next null row under column B of sheet1. Since
> > null row under column B of sheet 1 is R4, R4 will be overwritten.
> >
> > Thus the output will look like
> >
> > sheet1
> > column A column B
> > R1
> > R2 ABC 10
> > R3 DEF 12
> > R4 XYZ 13
> > R5 PQR 15


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Match and copy Janette Microsoft Excel Worksheet Functions 3 10th Jul 2009 04:50 AM
Local copy and Server copy do not match in Outlook 2003 =?Utf-8?B?amFzb24=?= Microsoft Outlook Discussion 1 9th May 2006 12:59 AM
Match and Copy =?Utf-8?B?R2VvZmY=?= Microsoft Excel Worksheet Functions 0 31st Jan 2006 04:23 PM
Match and Copy Kazza Microsoft Excel Discussion 0 20th Apr 2005 02:34 PM
Maybe this isn't possible to match name and copy? Annette Microsoft Excel Programming 18 28th Jul 2004 02:56 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:28 AM.