rudogg
New Member
- Joined
- Mar 18, 2022
- Messages
- 28
- Office Version
- 365
- Platform
- Windows
See the line in Orange for my note. Any help would be appreciated!!
VBA Code:
Sub Match_MPN_Change_OurPrice()
Workbooks(2).Worksheets(1).Activate
Dim Cl As Range, mydiffs As Integer, matcheddata As Integer
Dim Dic As Object
Set Dic = CreateObject("scripting.dictionary")
With Sheets(3)
For Each Cl In .Range("A2", .Range("A" & Rows.Count).End(xlUp))
If Cl.Value <> "" Then
Dic(Cl.Value) = Cl.Offset(, 2).Value
End If
Next Cl
End With
With Sheets(1)
For Each Cl In .Range("BX2", .Range("BX" & Rows.Count).End(xlUp))
If Dic.Exists(Cl.Value) Then
Cl.Interior.Color = vbGreen
matcheddata = matcheddata + 1
If Dic(Cl.Value) <> 0 And Dic(Cl.Value) <> 0# And Dic(Cl.Value) <> "n/a" And Dic(Cl.Value) <> "N/A" And Dic(Cl.Value) <> "-" And Dic(Cl.Value) <> Cl.Offset(, -58).Value Then
Cl.Offset(, -58).Value = Dic(Cl.Value)
[COLOR=rgb(251, 160, 38)] Cl.Offset(, -58).Interior.Color = vbGreen 'Unless the cell is already vbGreen, then I need to make the cell vbYellow[/COLOR]
mydiffs = mydiffs + 1
End If
End If
Next Cl
End With
'Display a message box to demonstrate the differences
MsgBox matcheddata & " MPN's Have Been Matched, And " & mydiffs & " 'Our Price' Prices Have Been Modified.", vbInformation
End Sub