So i basically want to get PO matched from the file browse from computer and copied in a way that wherever PO "9207116092" in C4 of file POD is mentioned in Masterfile ColumG "PO" (like we dont have to right "9207116092" again and again just onetime is enough and that value (01/03/2020 in this case) is pasted to al the rows having PO number "9207116092" in POD columnF in Masterfile


Noye: Use macro UPLOAD POD to upload file


  1. Sub uploadPODdata()
  2. Dim WScopy As Worksheet, WSdest As Worksheet, desWB As Workbook, FileToOpen As Variant, DRow As Long, cRow As Long, lastRow As Long, fnd As Range, PO As Range
  3. Set desWB = ThisWorkbook
  4. Set WSdest = desWB.Sheets(1)
  5. Application.ScreenUpdating = False
  6. FileToOpen = Application.GetOpenFilename(Title:="Browse for your file & Import Range", FileFilter:="Excel Files (*.xls*),*xls*")
  7. If FileToOpen = False Then Exit Sub
  8. Set OpenBook = Application.Workbooks.Open(FileToOpen)
  9. With Sheets(1)
  10. DRow = .Cells(Rows.Count, "C").End(xlUp).row
  11. For Each PO In Range("C5:C" & DRow)
  12. Set fnd = WSdest.Range("G:G" & DRow).Find(PO, LookIn:=xlValues, lookat:=xlWhole)
  13. If Not fnd Is Nothing Then
  14. fnd.Offset(, -1) = PO.Offset(, 1)
  15. End If
  16. Next PO
  17. End With
  18. With WSdest
  19. cRow = .Cells(.Rows.Count, "A").End(xlUp).row
  20. .Range("N4:N" & cRow).Formula = "=if(F4=E4,M4*1,M4*0)"
  21. End With
  22. ActiveWorkbook.Close False
  23. Application.CutCopyMode = False
  24. Application.ScreenUpdating = True
  25. End Sub