Uploading the data and pasting it into specific cell by matching the value in it

  • Hi!

    What i am trying to code is

    -Uploading the data from browser and pasting it Masterfile attached below by button name "Upload POD"

    - As both the workbooks have a same column name "PO" so while pasting it should be pasted into the respective row where that "PO" in the master file is location

    As for example In Masterfile B5 has PO of "2" so when uploading the document having Proof data occurs the value mentioned in PO of "2" in file Purchase should be paste corresponding row5 in POD columnE , the value against PO number 2 is 3rd Jan

    - I just basically wants to update the data by matching its PO numbers

    Note: Every row will have a different PO, so not really any chances of over-driven data

    for reference here is the code im using to upload data at first place mention in the macro of "UploadData"


    Sub upload_data()

    Dim WScopy As Worksheet, WSdest As Worksheet, desWB As Workbook, FileToOpen As Variant, cRow As Long

    Set desWB = ThisWorkbook

    Set WSdest = desWB.Sheets(1)

    Application.ScreenUpdating = False

    FileToOpen = Application.GetOpenFilename(Title:="Browse for your file & Import Range", FileFilter:="Excel Files (*.xls*),*xls*")

    If FileToOpen = False Then Exit Sub

    Set OpenBook = Application.Workbooks.Open(FileToOpen)

    With Sheets(1)

    cRow = .Cells(Rows.Count, "A").End(xlUp).row

    .Range("A4:H" & cRow).copy

    WSdest.Cells(WSdest.Rows.Count, "A").End(xlUp).Offset(1, 0).PasteSpecial xlPasteValuesAndNumberFormats

    End With

    ActiveWorkbook.Close False

    Application.CutCopyMode = False

    Application.ScreenUpdating = True

    End Sub

  • Here

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!