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

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

قام بنشر

السلام عليكم

اخوتي في الله ممكن المساعدة في اتمام الكود الذي يسمح بعمل كل خانات اليوزر فورم

و ان امكن جعل نوع الغياب في خانة واحدة و هذا بالاختيار نوع لغياب حيث عند ادخال البيانات فالمعطيات تذهب للعمود الخاص بها

و بارك الله فيكم

برنامج غيابات.xlsm

قام بنشر

 

مشكور أخي جزاءك عند الله

اتعبناك معنا

لا أدري اين الخلل ممكن من هو ملون بالأصفر

Dim r, i As Integer
Private Sub CommandButton1_Click()
For j = 1 To 8
         Cells(r, j) = Controls("TextBox" & j).Text
Next j
ListBox1.List(i, 0) = TextBox2.Text
End Sub
Private Sub CommandButton2_Click()
'lrw = Sheets(1).Cells(Rows.Count, 2).End(xlUp).Row
'For j = 1 To 8
'              Sheets(1).Cells(lrw + 1, j) = Controls("TextBox" & j).Text
'               Next j
'                     For i = 1 To 8
'              Next i
'            Controls("TextBox" & i).Text = ""
' ListBox1.AddItem
' ListBox1.List(ListBox1.ListCount - 1, 0) = Sheets(1).Cells(lrw + 1, 2).Value
'  ListBox1.List(ListBox1.ListCount - 1, 1) = lrw + 1
'   TextBox1.Value = Application.WorksheetFunction.Max(Sheets(1).Range("A4:A5000")) + 1
'TextBox2.SetFocus
Dim TotalRows As Long
Dim Sh As Worksheet
Set Sh = æÑÞÉ1
With Sh
TotalRows = .Cells(Rows.Count, "A").End(xlUp).Row
If TotalRows < 3 Then
TotalRows = 3
Else
TotalRows = TotalRows
End If
.Cells(TotalRows + 1, 1) = Me.TextBox1.Value
.Cells(TotalRows + 1, 2) = Me.TextBox2.Text
.Cells(TotalRows + 1, 3) = Format(TextBox3, "dd/mm/yyyy")
.Cells(TotalRows + 1, 4) = Me.TextBox4.Value
.Cells(TotalRows + 1, 5) = Me.TextBox5.Value
.Cells(TotalRows + 1, 6) = Me.TextBox6.Value
.Cells(TotalRows + 1, 9) = Me.TextBox14.Text
.Cells(TotalRows + 1, 10) = Me.TextBox9.Value
.Cells(TotalRows + 1, 11) = Me.TextBox10.Value
.Cells(TotalRows + 1, 12) = Me.TextBox11.Value
.Cells(TotalRows + 1, 13) = Me.TextBox13.Value
.Cells(TotalRows + 1, 14) = Me.TextBox15.Value

End With
ClearForm
TextBox2.SetFocus

End Sub
Private Sub CommandButton3_Click()
If MsgBox("ÓíÊã ÇáÍÐÝ åá ÃäÊ ãÊÃßÏ¿", vbQuestion + vbYesNo) = vbYes Then
Sheets(1).Cells(r, 1).EntireRow.Delete
For Z = 1 To 8
Sheets(1).Cells(r, Z).Delete Shift:=xlUp
Next Z
Sheets(1).Cells(r, 1).Resize(r, 11).Delete Shift:=xlUp
MsgBox "ÊãÊ ÚãáíÉ ÇáÍÐÝ ÈäÌÇÍ"
For y = 1 To 8
Controls("Textbox" & y).Text = ""
Next y
ListBox1.Clear
UserForm_Activate
TextBox12 = ""
End If
End Sub

Private Sub Label12_Click()

End Sub

Private Sub Label23_Click()

End Sub

Private Sub Label7_Click()

End Sub

Private Sub Label9_Click()

End Sub

Private Sub ListBox1_Click()
For i = 0 To ListBox1.ListCount
    If ListBox1.Selected(i) = True Then
   For j = 1 To 8
        Controls("TextBox" & j).Text = Cells(ListBox1.List(i, 1), j)
        Next j
        r = ListBox1.List(i, 1)
        Exit For
    End If
Next i
End Sub
Private Sub TextBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
   For i = 1 To 6
            Controls("TextBox" & i).Text = ""
 Next i
TextBox1.Value = Application.WorksheetFunction.Max(Sheets(1).Range("A4:A5000")) + 1
TextBox2.SetFocus
End Sub
Private Sub TextBox12_Change()
ListBox1.Clear
     For i = 1 To 8
            Controls("TextBox" & i).Text = ""
    Next i
    If TextBox12 = "" Then Exit Sub
    Sheets(1).Activate
    ss = Sheets(1).Cells(Rows.Count, 2).End(xlUp).Row
     k = 0
          For Each C In Range("B4:B" & ss)
    If C Like TextBox12.Value & "*" Then
        ListBox1.AddItem
        ListBox1.List(k, 0) = Cells(C.Row, 2).Value
        ListBox1.List(k, 1) = C.Row
        k = k + 1
    End If
Next C
End Sub

Private Sub TextBox6_Change()
Me.TextBox7.Value = (Val(Me.TextBox5.Value) + Val(Me.TextBox6.Value)) / 2
'TextBox7 = Val((TextBox5 + TextBox6) / 2)
End Sub

'Private Sub TextBox5_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
'TextBox12.Value = ""
'ListBox1.Clear
'End Sub
Private Sub UserForm_Activate()
TextBox12.SetFocus
For i = 4 To Sheets(1).Cells(Rows.Count, 2).End(xlUp).Row
ListBox1.AddItem
 ListBox1.List(i - 4, 0) = Cells(i, 2).Value
  ListBox1.List(i - 4, 1) = i
      Next i
 TextBox1.Value = Application.WorksheetFunction.Max(Sheets(1).Range("A4:A5000")) + 1
TextBox2.SetFocus
End Sub
Sub ClearForm()
For Each ctl In Me.Controls
If TypeName(ctl) = "TextBox" Then
ctl.Value = vbNullString
End If
Next ctl

End Sub

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