اخى الحسامى
اريد ان تشرح لى جزء بسيط من الكود
ظبط ظهور الصفحة فى التقرير
بمعنى اذا اردت اخفاء عمود ماذا افعل
ارجو الشرح للاهمية
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("c3:c4,e3,e4")) Is Nothing Then
Application.ScreenUpdating = False
On Error Resume Next
If Target.Cells.Count > 1 Then Exit Sub
If Target Is emptey Then
sheet2.Range("b8:m5000,I8:I5000").ClearContents
r = 8
For i = 5 To Sheet1.Range("b10000").End(xlUp).Row + 1
Application.ScreenUpdating = False
If sheet2.Range("c3").Value = "" Then GoTo a
If sheet2.Range("c3").Value = Sheet1.Cells(i, "d") Then
a:
If sheet2.Range("c4").Value = "" Then GoTo a1
If sheet2.Range("c4").Value = Sheet1.Cells(i, "m") Then
a1:
If sheet2.Range("e4").Value = "" Then GoTo a2
If sheet2.Range("e4").Value >= Sheet1.Cells(i, "b") Then
a2:
If sheet2.Range("e3").Value = "" Then GoTo a3
If sheet2.Range("e3").Value <= Sheet1.Cells(i, "b") Then
a3:
sheet2.Cells(r, 2) = Sheet1.Cells(i, 2)
sheet2.Cells(r, 12) = Sheet1.Cells(i, 13)
For j = 4 To 11
sheet2.Cells(r, j) = Sheet1.Cells(i, j + 1)
Next j
r = r + 1
End If
End If
End If
End If
Next i
End If
End If
End Sub
اعلم ان التغيير فى هذا الجزء
a3:
sheet2.Cells(r, 2) = Sheet1.Cells(i, 2)
sheet2.Cells(r, 12) = Sheet1.Cells(i, 13)
For j = 4 To 11
sheet2.Cells(r, j) = Sheet1.Cells(i, j + 1)
Next j
r = r + 1