VBA Update a column with Master List from other spread sheet

ivonsurf123

New Member
Joined
May 17, 2022
Messages
14
Office Version
  1. 2021
Platform
  1. Windows
Hello,

Need help with my code, I want to find the wrong name in one spread sheet per example: "CRYOMAX COOLING SYSTEM CORP" (wrong) compare with a Master List: "CRYOMAX COOLING SYSTEM CORP."(Correct)
"SUN ELECTRONIC CO LTD" (Wrong) "SUN ELECTRIC CO.,LTD." (Correct) and Update the wrong names with the correct names that are in the Master List, Please Help, my code is missing something... Thank you.

Sub Update_Suppliers()

Dim wrkBK As Workbook
Dim DocFldr As String

Dim i, total, fRow As Integer
Dim found As Range
Dim w As Range


DocFldr = CreateObject("WScript.Shell").SpecialFolders("Desktop")

Set wrkBK = Workbooks.Open(DocFldr & "\FY22_Monthly_analysis_Freight_in_out\SUPPLIERS_LIST.xlsx")

Application.ScreenUpdating = False

total = Workbooks("SUPPLIERS_LIST.xlsx").Worksheets("SUPPLIERS_LIST").Range("B" & Rows.Count).End(xlUp).Row

For i = 1 To total
answer1 = Workbooks("SUPPLIERS_LIST.xlsx").Worksheets("SUPPLIERS_LIST").Range("B" & i).Value
Set found = Workbooks("Invoice rep. w. Chg Dtl June, 2022.xlsM").Worksheets("Copy").Columns("I:I").Find(what:=answer1) 'finds a match
If found Is Nothing Then
'Workbooks("Invoice rep. w. Chg Dtl June, 2022.xlsM").Worksheets("Copy").Range("I" & i).Value = "NO MATCH"
Else
fRow = Workbooks("Invoice rep. w. Chg Dtl June, 2022.xlsM").Worksheets("Copy").Columns("I:I").Find(what:=answer1).Row
Workbooks("Invoice rep. w. Chg Dtl June, 2022.xlsM").Worksheets("Copy").Range("I" & fRow).Value = Workbooks("SUPPLIERS_LIST.xlsx").Worksheets("SUPPLIERS_LIST").Range("B" & i).Value

End If
Next i


End Sub
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Fast answer needs visual help. Pls attach a screenshot/XL2BB to see the whole picture
 
Upvote 0
Sheet 2 needs to be updated according to the MasterList Names: Correct Name is this example is "SUN ELECTRONIC CO.,LTD." from The Master List. Also, if there is a new Name in sheet 2 that is not in the MAster List I need to highlighted. Thank you.
 

Attachments

  • MasterList.png
    MasterList.png
    64 KB · Views: 4
  • Sheeet 2.png
    Sheeet 2.png
    5.1 KB · Views: 5
Upvote 0

Forum statistics

Threads
1,214,611
Messages
6,120,510
Members
448,967
Latest member
screechyboy79

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