Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 169
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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
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
Useful Additions Ron100 Excel Discussion (Misc queries) 1 January 13th 10 01:38 PM
Additions Marc Excel Discussion (Misc queries) 1 November 11th 09 05:35 AM
Can I allow Additions but not Edits? Keith Excel Discussion (Misc queries) 2 November 9th 06 01:10 PM
Cell Additions acopper57 via OfficeKB.com Excel Worksheet Functions 0 May 17th 06 11:54 PM
Multiple additions BIYB Excel Discussion (Misc queries) 4 July 26th 05 04:22 PM


All times are GMT +1. The time now is 10:00 PM.

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"