Excel VBA Multiple Sheet Data Entry Software for Beginners | Excel VBA Userform Project | VedantSri
Excel Userform Multi Sheet Data Entry Software
Aap Excel me VBA code likh kar ek hi UserForm ke dwara alag-alag sheets (Aadhar, PAN Card, ITR) par data entry kar sakte hain. niche diye gaye steps ko follow kren.
Step 1: Sheets ka Setup
- Aapke Excel workbook me teen sheets honi chahiye:
Aadhar
PAN Card
ITR
- Har sheet me column headings specify karen jaise:
Aadhar
: Name, Aadhar Number, AddressPAN Card
: Name, PAN Number, DOBITR
: Name, ITR Number, Amount
Step 2: UserForm Design
- Developer Tab → Visual Basic Editor (Alt + F11).
- Insert → UserForm.
- UserForm me fields add karen:
- TextBox:
Textbox1
,
,Textbox2
Textbox3
. - ComboBox:
Combobox1
(Options: Aadhar, PAN Card, ITR). - CommandButton:
Commandbutton1
.
- TextBox:
Step 3: VBA Code
UserForm ke code window me niche diya code paste karen:
'DataEntry Button ka code hai
Private Sub CommandButton1_Click()
Dim ws As Worksheet
Dim lastRow As Long
Dim category As String
Dim name As String, number As String, extra As String
'Textbox aur combobox ke name ka code hai
category = ComboBox1.Value
name = TextBox1.Value
number = TextBox2.Value
extra = TextBox3.Value
'ComboBox me Listed Word ko Sheet se Connect krne ka code
If category = "Aadhar" Then
Set ws = ThisWorkbook.Sheets("Aadhar")
ElseIf category = "PAN Card" Then
Set ws = ThisWorkbook.Sheets("PAN Card")
ElseIf category = "ITR" Then
Set ws = ThisWorkbook.Sheets("ITR")
Else
MsgBox "Please select a valid category.", vbExclamation
Exit Sub
End If
'Next Empty Row find krne ka code hai
lastRow = ws.Cells(ws.Rows.Count, 1).End(xlUp).Row + 1
'Data ko Selected Combobox List se Sheet me Entry ka Code
ws.Cells(lastRow, 1).Value = name
ws.Cells(lastRow, 2).Value = number
ws.Cells(lastRow, 3).Value = extra
'Entry ke Baad Userform ko Clear krne ka code hai
TextBox1.Value = ""
TextBox2.Value = ""
TextBox3.Value = ""
ComboBox1.Value = ""
MsgBox "Data added successfully to " & category & " sheet.", vbInformation
End Sub
Step 4: Testing
- Excel workbook save karein (Macro-Enabled Workbook –
.xlsm
). - UserForm ko run karein (Alt + F8 → UserForm1 → Run).
- Form bhar kar “Submit” button click karein.