Excel VBA Auto GST and Discount in Data Entry beginners | Excel VBA Project by Pradip VedantSri
Data Entry Button Code
‘Yah Entry Button ka Code hai
Private Sub CommandButton1_Click()
Dim x As Long
Dim y As Worksheet
Set y = Sheet1
x = y.Range(“A” & Rows.Count).End(xlUp).Row
With y
.Cells(x + 1, “A”).Value = TextBox1.Text
.Cells(x + 1, “B”).Value = TextBox2.Text
.Cells(x + 1, “C”).Value = TextBox3.Text
.Cells(x + 1, “D”).Value = TextBox4.Text
.Cells(x + 1, “E”).Value = TextBox5.Text
.Cells(x + 1, “F”).Value = TextBox6.Text
.Cells(x + 1, “G”).Value = TextBox7.Text
.Cells(x + 1, “H”).Value = TextBox8.Text
.Cells(x + 1, “I”).Value = TextBox9.Text
.Cells(x + 1, “J”).Value = TextBox10.Text
.Cells(x + 1, “K”).Value = TextBox11.Text
End With
On Error Resume Next
Unload Me
UserForm1.Show
End Sub
‘Yah Textbox Sutotal ka code hai
Private Sub TextBox10_Change()
Call Module2.Calc
End Sub
Durgakund 8808888478Rathyatra 9415802061दोनों शाखाएँ सोमवार–शनिवार सुबह 7 से रात 8 बजे तक खुली हैं। कोर्स की जानकारी के लिए Durgakund 8808888478 और Rathyatra 9415802061 पर सातों दिन, किसी भी समय कॉल कर सकते हैं।
‘yah Rate Textbox ka code hai
Private Sub TextBox5_Change()
Dim a As Double
a = 0
If Len(TextBox4.Value) > 0 Then a = TextBox5.Value * TextBox4.Value
TextBox10 = a
End Sub
‘yah GST Textbox ka Code hai
Private Sub TextBox6_Change()
Dim a As Double
a = 0
If Len(TextBox6.Value) > 0 Then a = TextBox10.Value / 100 * TextBox6.Value
TextBox7 = a
End Sub
‘yah GST amt Textbox code hai
Private Sub TextBox7_Change()
Call Module2.Calc
End Sub
‘yah Discount textbox ka code hai
Private Sub TextBox8_Change()
Dim a As Double
a = 0
If Len(TextBox8.Value) > 0 Then a = TextBox10.Value / 100 * TextBox8.Value
TextBox9 = a
End Sub
‘yah dis amt ka code hai
Private Sub TextBox9_Change()
Call Module2.Calc
End Sub
‘yah automatic Sr No aur Date ka Code hai
Private Sub UserForm_Initialize()
TextBox1 = Application.WorksheetFunction.Max(Sheet1.Range(“A2:A100000”)) + 1001
TextBox2.Text = Format(Now(), “dd mmm, yy”)
End Sub
Module1 ka code
‘Module1 ka code hai Userform1 ko show Krne ke liye
Sub Sheet1_SmileyFace1_Click()
UserForm1.Show
End Sub
Module2 Ka Code
Module2 ka code hai Dis Amt, GST Amt aur SubTotal ke liye
Sub Calc()
Dim a As Double
a = 0
If Len(UserForm1.TextBox7.Value) > 0 Then a = a + UserForm1.TextBox7.Value
If Len(UserForm1.TextBox9.Value) > 0 Then a = a – UserForm1.TextBox9.Value
If Len(UserForm1.TextBox10.Value) > 0 Then a = a + UserForm1.TextBox10.Value
UserForm1.TextBox11 = a
End Sub

