بعد اذن الأخ صاحب الملف
لقد وجدت الفورم فى المنتدى
الحمد لله أخيرا
ملف رائع جدا
وهذا هو الكود أرجو كتابه الشرح الخاص بكل سطر
Option Explicit
'******************************************************
' اسم ورقة البيانات
Const Sh_MyDate As String = "بيانات اساسية"
'------------------------------------------------------
' رقم صف رؤوس الاعمدة
Const lrow As Integer = 5
'------------------------------------------------------
' عدد الاعمدة التي تريدها ابتداءا من العمود الاول
Const lcol As Integer = 28
'******************************************************
Private k As Integer
Private Sub CommandButton2_Click()
Unload Me
End Sub
Private Sub CommandButton3_Click()
Dim j As Integer
k = ScrollBar1.Value
label_Scrol_Value.Caption = "رقم : " & k
Application.ScreenUpdating = False
For j = 1 To lcol
If Me.Controls("Textbox" & j).Locked = False Then
Worksheets(Sh_MyDate).Cells(k + lrow, j) = Me.Controls("Textbox" & j).Value
End If
Next j
Application.ScreenUpdating = True
ScrollBar1_Change
End Sub
Private Sub CommandButton4_Click()
k = ScrollBar1.Value
Worksheets(Sh_MyDate).Cells(k + lrow, 1).EntireRow.Delete
ScrollBar1_Change
End Sub
Private Sub ScrollBar1_Change()
Dim j As Integer
k = ScrollBar1.Value
label_Scrol_Value.Caption = "رقم : " & k
With Worksheets(Sh_MyDate)
.Cells(k + lrow, 1).Select
For j = 1 To lcol
Me.Controls("Textbox" & j).Value = .Cells(k + lrow, j).Value
Next j
End With
Frame1.ScrollTop = 0
End Sub
Private Sub UserForm_Activate()
ScrollBar1_Change
End Sub
Private Sub UserForm_Initialize()
Dim MyLabel As Control, MyTxtbox As Control
Dim i As Integer, MyTop As Integer, MyFrame_Top As Integer
MyTop = 20
MyFrame_Top = 12
Frame1.ScrollHeight = (lcol * MyTop) + MyFrame_Top
If Frame1.ScrollHeight > Frame1.Height Then Frame1.SpecialEffect = 3
For i = 1 To lcol
Set MyLabel = Frame1.Controls.Add("Forms.label.1", "label" & i, True)
With MyLabel
.BorderStyle = 1
.Move 180, MyFrame_Top, 80
.Caption = Worksheets(Sh_MyDate).Cells(lrow, i).Value
.TextAlign = fmTextAlignCenter
.Font.Bold = True
.Font.Size = 12
.FontName = "Times New Roman"
.ForeColor = vbRed
End With
Set MyTxtbox = Frame1.Controls.Add("Forms.TextBox.1", "TextBox" & i, True)
With MyTxtbox
.Move 0, MyFrame_Top, 180
.TextAlign = fmTextAlignCenter
.Font.Bold = True
.Font.Size = 12
.FontName = "Times New Roman"
If Worksheets(Sh_MyDate).Cells(lrow + 1, i).HasFormula Then
.BackColor = &HFFC0C0
.Locked = True
End If
End With
MyFrame_Top = MyFrame_Top + MyTop
Next i
End Sub
ارجو كتابه الشرح فى الملف نفسه
اعداد تقارير مدرسية.rar