try this
Sub Product_Reg()
Dim Total_Reg, Total_UnReg As Integer
Dim ws1 As Worksheet
Dim ws2 As Worksheet
Dim Lastcell As Range
Dim i As Integer
Dim Lookup_value As String
'//these to processes increase speed
Application.ScreenUpdating = False
Application.EnableEvents = False
'//Set Worksheets to required sheet names - rename as required
Set ws1 = Sheets("ProductDatabase")
Set ws2 = Sheets("tmpWeb")
'//finds the last cell so loop is minimal
Set Lastcell = ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell)
For i = 1 To Lastcell.Row
Lookup_value = ws2.Cells(i, "A")
'//Starts looking in productdata sheet for part
If Len(Lookup_value) <> 0 Then
For x = 1 To ws1.Cells.SpecialCells(xlCellTypeLastCell).Row
If ws1.Cells(x, "A") = Lookup_value Then
If Not ws1.Cells(x, "H") = "Registered" Then
ws1.Cells(x, "H") = "Registered"
'// add to total so user can see products have been registered
Total_Reg = Total_Reg + 1
End If
End If
Next
End If
Next
MsgBox ("Total Products Registered: " & Total_Reg & "")
Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub
Jon
Bookmarks