I am having two workbooks (Destination.xlsm & Source 1.xlsx). On both work sheets column C employees name available. and from column E to P I am updating their ratings . So i want copy employees rating from Source1.XLSX and paste to Destination.XLSM file.
for that i am using vlookup code to lookuup the name and paste the value accordingly.
My code is here
- Sub copydatas()
- Dim SrcWkb As Workbook
- Dim SrcWks As Worksheet
- Dim DstWkb As Workbook
- Dim DstWks As Worksheet
- Dim Myrange As Long
- Dim x As Long
- Set SrcWkb = Workbooks.Open(ThisWorkbook.Path & "/" & "Source 1.xlsx")
- Set SrcWks = SrcWkb.Worksheets("20")
- Set DstWks = ThisWorkbook.Worksheets("Dest")
- Myrange = DstWks.Range("C3")
- DstWks.Range("E3").Value = Application.Worsheetfunctions.VLookup(Myrange, SrcWks.Range("C4:P"), 5, False)
- Application.DisplayAlerts = True
- End Sub
I am getting error message while running this code.
Can any one correct my cone and let me know whee is mistake.
For your reference i am uploading my files here