Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Additions&Removals
Hi,
I have a situation: In Sheet 1 I have 3 columns(A,B,C) Job Number Job Name Client 111 abc Micro 112 gfg Donc 113 fsdfsd Nissan In sheet 2 I have 1 column (A) Job Number 111 113 114 115 I am writing a macro which will take each job Number in Sheet1, search in Sheet 2 and identify additions(112) and Removals (114,115) and then copy the details (Job Number, Job Name, Client) to Sheet 3 I think my macro is missing a couple of key lines: Sub dev() Dim i For i = 1 To 10 If Worksheets("Sheet1").Cells(i, 1) = Worksheets("Sheet2").Cells(j, 1) Then Cells(i, 1).Copy Destination:=Worksheets("Sheet3").Range("A1") End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Additions&Removals
In both cases you are taking items in one list and looking to see if they are
"Not included" in another list. Does this help get you started: http://www.wopr.com/cgi-bin/w3t/show...c=1#Post430586 "teresa" wrote: Hi, I have a situation: In Sheet 1 I have 3 columns(A,B,C) Job Number Job Name Client 111 abc Micro 112 gfg Donc 113 fsdfsd Nissan In sheet 2 I have 1 column (A) Job Number 111 113 114 115 I am writing a macro which will take each job Number in Sheet1, search in Sheet 2 and identify additions(112) and Removals (114,115) and then copy the details (Job Number, Job Name, Client) to Sheet 3 I think my macro is missing a couple of key lines: Sub dev() Dim i For i = 1 To 10 If Worksheets("Sheet1").Cells(i, 1) = Worksheets("Sheet2").Cells(j, 1) Then Cells(i, 1).Copy Destination:=Worksheets("Sheet3").Range("A1") End Sub |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Additions&Removals
Sub dev()
Dim i, j, cLastRow For i = 1 To 10 With Worksheets("Sheet3") cLastRow = .Cells(Rows.Count, "A").End(xlUp).Row If cLastRow = 1 And .Cells(cLastRow, "A").Value < "" Then cLastRow = cLastRow + 1 For j = 1 To Worksheets("Sheet2").Cells(Rows.Count, "A").End(xlUp).Row If Worksheets("Sheet1").Cells(i, 1) = Worksheets("Sheet2").Cells(j, 1) Then Worksheets("Sheet1").Cells(i, 1).EntireRow.Copy Destination:=.Range("A" & cLastRow) Exit For End If Next j End With Next i End Sub -- HTH RP (remove nothere from the email address if mailing direct) "teresa" wrote in message ... Hi, I have a situation: In Sheet 1 I have 3 columns(A,B,C) Job Number Job Name Client 111 abc Micro 112 gfg Donc 113 fsdfsd Nissan In sheet 2 I have 1 column (A) Job Number 111 113 114 115 I am writing a macro which will take each job Number in Sheet1, search in Sheet 2 and identify additions(112) and Removals (114,115) and then copy the details (Job Number, Job Name, Client) to Sheet 3 I think my macro is missing a couple of key lines: Sub dev() Dim i For i = 1 To 10 If Worksheets("Sheet1").Cells(i, 1) = Worksheets("Sheet2").Cells(j, 1) Then Cells(i, 1).Copy Destination:=Worksheets("Sheet3").Range("A1") End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Useful Additions | Excel Discussion (Misc queries) | |||
Additions | Excel Discussion (Misc queries) | |||
Can I allow Additions but not Edits? | Excel Discussion (Misc queries) | |||
Cell Additions | Excel Worksheet Functions | |||
Multiple additions | Excel Discussion (Misc queries) |