اذهب الي المحتوي
أوفيسنا
بحث مخصص من جوجل فى أوفيسنا
Custom Search

عايز اعمل يوزرفورم للادخال


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

السلام عليكم

تنسخ هذا الكود في زر الحفظ مع مراعات أن مربع النص الأول يملأ تلقائيا 

Private Sub CommandButton1_Click()

Dim x As Byte, i As Byte, R As Integer, sh As Worksheet
Set sh = Sheets("sheet2")

    With sh
    R = .Cells(Rows.Count, "B").End(xlUp).Row + 1
    For x = 2 To 8
    .Cells(R, x).Value = Me.Controls("TextBox" & x) '.Value
    Next
    End With

    TextBox1.Value = Sheets("sheet2").Cells(Rows.Count, "B").End(xlUp).Row - 1
    For i = 2 To 8
    Me.Controls("TextBox" & i) = ""
    Next

End Sub

و في حدث الفورم UserForm_Initialize تكتب هذا الكود الذي يقوم بمعرفة آخر صف مكتوب و ترقيمه

Private Sub UserForm_Initialize()

TextBox1.Value = Sheets("sheet2").Cells(Rows.Count, "B").End(xlUp).Row - 1

End Sub

 

  • Like 1
رابط هذا التعليق
شارك

'بعد إذن أخي أبو حنين ،
قم بكتابة هذا في بداية الكود

If Me.textbox1.Value = "" Then
MsgBox "ضع الرسالة التي تريد ", vbOKOnly, "خطأ"
textbox1.SetFocus
ElseIf Me.TextBox2.Value = "" Then
MsgBox "ضع الرسالة التي تريد ", vbOKOnly, "خطأ"
TextBox2.SetFocus
ElseIf Me.TextBox3.Value = "" Then
MsgBox "ضع الرسالة التي تريد ", vbOKOnly, "خطأ"
TextBox3.SetFocus
Else

 

  • 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