Conditional Formating with formula

JSDyck

New Member
Joined
Feb 22, 2010
Messages
13
In column A I have over 10,000 inventory items where there are some duplicates. (I cannot remove the duplicates this list has to remain in this order)
in Column B I am entering the amount that I need to order

Is there a way when i enter a qty in column b and I have already ordered that item somewhere else that it will notify me either by conditional formatting or some other way?

Thanks in advance.
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Where is the information about what you already ordered?
 
Upvote 0
Copy and paste this macro into the worksheet code module. Do the following: right click the tab for your sheet and click 'View Code'. Paste the macro into the empty code window that opens up. Close the code window to return to your sheet. Enter a quantity in column B and exit the cell.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Intersect(Target, Range("B:B")) Is Nothing Then Exit Sub
    Dim sAddr As String
    Dim foundVal As Range
    Set foundVal = Range("A:A").Find(Target.Offset(0, -1), LookIn:=xlValues, lookat:=xlWhole)
    If Not foundVal Is Nothing Then
        sAddr = foundVal.Address
        Do
            If foundVal.Offset(0, 1) <> "" Then
                If foundVal.Row <> Target.Row Then
                    MsgBox ("You have already ordered " & foundVal.Offset(0, 1).Value & " of item " & Target.Offset(0, -1) & " in row" & foundVal.Row & ".")
                End If
            End If
            Set foundVal = Range("A:A").FindNext(foundVal)
        Loop While foundVal.Address <> sAddr
        sAddr = ""
    End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top