تفضل أخى
Private Function GetData(Path, File, Sheet, Address)
Dim Data$
Data = "'" & Path & "[" & File & "]" & Sheet & "'!" & _
Range(Address).Range("A1").Address(, , xlR1C1)
GetData = ExecuteExcel4Macro(Data)
End Function
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, [C1]) Is Nothing Then
Dim FilePath$, Address$
'***************************************
Const FileName$ = "MyExcel.xlsm"
Const SheetName$ = "ورقة1"
FilePath = ActiveWorkbook.Path & "\"
'***************************************
DoEvents
Application.ScreenUpdating = False
If Dir(FilePath & FileName) = Empty Then
MsgBox "الملف " & FileName & " غير موجود", , "ملف غير موجود"
Exit Sub
End If
x = Cells(1, 3).Value + 1
Address = Cells(x, 2).Address
Cells(4, 3) = GetData(FilePath, FileName, SheetName, Address)
Address = Cells(x, 3).Address
Cells(5, 3) = GetData(FilePath, FileName, SheetName, Address)
End If
End Sub
Vlookup_VBA.rar