Fully Automatic Excel VBA Data Entry form

 Fully Automatic Excel VBA Data Entry form


Fully Automatic Data Entry Form in Excel VBA lesson - 78 | Project - 2

Download Practice File - Click here

Download VBA Code File - Click here

Copy Code Here

Option Explicit

Sub Reset()

Dim i As Long

i = [Counta(Database!A:A)] 'identifying last row

With frmform

.txtname.Value = ""

.txtID.Value = ""

.txtcont.Value = ""

.txtdate.Value = ""

.txtcity.Value = ""

.optmale.Value = False

.Optfemale.Value = False

    .cmddesg.Clear

    .cmddesg.AddItem "Manager"

    .cmddesg.AddItem "Accountant"

    .cmddesg.AddItem "Supervisor"

    .cmddesg.AddItem "Watchman"

    .cmddesg.AddItem "Cleark"

    .Lstdatabase.ColumnCount = 8

    .Lstdatabase.ColumnHeads = True

    .Lstdatabase.ColumnWidths = "30,70,65,60,60,55,60,70"

    If i > 1 Then

    .Lstdatabase.RowSource = "Database!A2:H" & i

    Else

    .Lstdatabase.RowSource = "Database!A2:H2"

    End If

    End With


End Sub

Sub submit()

Dim sh As Worksheet

Dim i As Long

Set sh = ThisWorkbook.Sheets("Database")

i = [Counta(Database!A:A)] + 1

With sh

    .Cells(i, 1) = i - 1

    .Cells(i, 2) = frmform.txtname.Value

    .Cells(i, 3) = frmform.txtID.Value

    .Cells(i, 4) = frmform.txtcont.Value

    .Cells(i, 5) = frmform.txtdate.Value

    .Cells(i, 6) = frmform.txtcity.Value

    .Cells(i, 7) = IIf(frmform.Optfemale.Value = True, "Female", "Male")

    .Cells(i, 8) = frmform.cmddesg.Value

          End With

End Sub


Sub show_form()

frmform.Show

End Sub

Private Sub cmdcancel_Click()

Dim msgValue As VbMsgBoxResult

msgValue = MsgBox("Do you want to reset it?", vbYesNo + vbInformation, "confirmation")

If msgValue = vbNo Then Exit Sub

Call Reset

End Sub


Private Sub cmdsave_Click()

Dim msgValue As VbMsgBoxResult

msgValue = MsgBox("Do you want to save it?", vbYesNo + vbInformationn, "Confirmation")

If msgValue = vbNo Then Exit Sub

Call submit

Call Reset

End Sub

Private Sub UserForm_Initialize()

Call Reset

End Sub

Download Practice File - Click here

Download VBA Code File - Click here

कोई टिप्पणी नहीं

टिप्पणी: केवल इस ब्लॉग का सदस्य टिप्पणी भेज सकता है.

MS Excel to WhatsApp Bulk Message in single Click

Excel to WhatsApp Bulk Message VBA Code File Download VBA Note Pad File - Click here Download Excel Practice File - Click here Copy Code her...

Blogger द्वारा संचालित.