اذهب الي المحتوي
أوفيسنا

الردود الموصى بها

قام بنشر

السلام عليكم ورحمة الله

استخدمى هذه الاكواد الثلاثة

Sub Get_Data()
Dim ws As Worksheet, Sh As Worksheet
Dim Arr As Variant, Temp As Variant
Dim LR As Long, i As Long, j As Long, p As Long
Dim PatName As String

Set ws = Sheets("تقرير بحالات الاعاقة")
ws.Range("B5:I1000").ClearContents
PatName = ws.Range("D2").Value
Set Sh = Sheets("اعاقات خاصة")
LR = Sh.Range("C" & Rows.Count).End(xlUp).Row
Arr = Sh.Range("B3:I" & LR).Value
ReDim Temp(1 To UBound(Arr, 1), 1 To UBound(Arr, 2))
For i = 1 To UBound(Arr, 1)
If Arr(i, 4) = PatName Then
p = p + 1
For j = 1 To UBound(Arr, 2)
Temp(p, j) = Arr(i, j)
'Temp(p, 1) = p
Next
End If
Next
If p > 0 Then ws.Range("B5").Resize(p, UBound(Temp, 2)).Value = Temp
Call Get_Photo
End Sub
Sub Get_Photo()
Application.ScreenUpdating = False
Dim StudName As String, E As String, Dpath As String
Dim pics As Object
Dim Sh As Worksheet
Dim C As Range, H
Application.ScreenUpdating = False
Set Sh = Sheets("تقرير بحالات الاعاقة")
For Each pics In Sh.Pictures
pics.Delete
Next pics
On Error Resume Next
For Each C In Sh.Range("J5:J1000")
StudName = C.Offset(0, -8).Value
If C.Offset(0, -8).Value <> "" Then
Dpath = ActiveWorkbook.Path
myDir = Dpath & "\" & "صور" & "\"
E = ".jpg"
Sh.Shapes.AddPicture Filename:=myDir & StudName & E, _
linktofile:=msoFalse, savewithdocument:=msoTrue, Left:=C.Left, _
Top:=C.Offset(0, 8).Top, Width:=C.Offset(0, 8).Width, Height:=C.Offset(0, 8).Height
End If
Next
Application.ScreenUpdating = True

End Sub
Sub Delete2_Photos()
Application.ScreenUpdating = False
Dim pics As Object
Dim ws As Worksheet
Set ws = Sheets("تقرير بحالات الاعاقة")
For Each pics In ws.Pictures
    pics.Delete
Next pics
Application.ScreenUpdating = True
End Sub

 

  • Like 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

زائر
اضف رد علي هذا الموضوع....

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • تصفح هذا الموضوع مؤخراً   0 اعضاء متواجدين الان

    • لايوجد اعضاء مسجلون يتصفحون هذه الصفحه
×
×
  • اضف...

Important Information