Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

I have some code I need help with. see below

  Asked By: Willie    Date: Mar 04    Category: MS Office    Views: 767
  

I bough a karaoke DVD with 1029 songs a year ago. Now I want to buy
another and it has 1234 songs. The trouble is, I dont want to buy a
bunch of songs I already have. I put the list of songs titles I
already have in column "A" and I put the list of songs I'm thinking
of buying in Column "B". I want to take each song from column "A"
and search for it in Column "B" and if I find it, copy it to
column "C". Seems simple enough, but folks, I need a 3D thinker to
help me with this. My script will do the first iteration of
searchs, but wont move on to cell A2,3,4... etc. what am I doing
wrong?

Sub NewSongs()

Dim A As Integer
Dim TEST1 As String
Dim TEST2 As String
Dim B As Integer
Dim C As Integer

Do
A = A + 1
TEST1 = Cells(A, 1).Value 'Songs that I currently have, in
column A
If TEST1 = "" Then
Exit Do
End If
Do
B = B + 1
TEST2 = Cells(B, 2).Value 'Songs that im looking to buy,
in column B
If TEST2 = "" Then
Exit Do
End If
If TEST1 = TEST2 Then
C = C + 1
Cells(C, 3) = Cells(B, 2) 'Songs that I already
have in column "A" and dont need, in Column C
Else
End If

Loop
Loop



End Sub

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Becky Baker     Answered On: Mar 04

=IF(ISNA(MATCH(B1,A:A,0)),"New","Have")

 
Didn't find what you were looking for? Find more on I have some code I need help with. see below Or get search suggestion and latest updates.




Tagged: