lookup for repeated PN

J

Junior728

Hi Sir,

i am trying to do a macro that searches for repeated PN value from my daily
kept log (col C) so that those previously done can be detected and not redo
the PN again for the next day.

I tried the follwing lines but all returns "N" value(Col L) even when i have
repeated PN on Column K("k1")which proves that the macro is not functioning.
How to make sure that one cell value are checked throughout the whole col C
before the next cell(K2..K3..K4..) ? Is there other alternate ways other than
use VLOOKUP coz for Vlookup does not work for me..i want something that not
only check row on row. but one row("K1") to all the other rows(Col C)

*note: all the kvalues are not the same.

Once again, a million thanks for your help.

Cheers=)

Example:

'Application.ScreenUpdating = False

Sub SearchRepeatPNs()

Range("A65536").Select
Selection.End(xlUp).Select
NumOfRows = ActiveCell.Row

Sheets("Sheet1").Select
Range("K2").Select 'Specify ActiveCell

'Start of Loop
For CurrentRow = 2 To NumOfRows
PN$ = Cells(CurrentRow, 11) 'column K
Repeat$ = Cells(CurrentRow, 12) 'column L

'Range("L" & CurrentRow).Select
Repeat$ =
"=IF(VLOOKUP(PN$),Sheet1!C2:C65536,1,FALSE),1,VLOOKUP(PN$,Sheet1!C1:C63356,1,FALSE))"


If Trim(PN$) = Trim(Repeat$) Then 'Match Value Found
Cells(CurrentRow, 12) = "Y"
Else
Cells(CurrentRow, 12) = "N"
End If


Next
MsgBox ("BINGO!!!END MACRO")


End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top