Showing posts with label MS Excel VBA Coding. Show all posts
Showing posts with label MS Excel VBA Coding. Show all posts

Monday, 25 May 2026

Student management Data Entry Based Application Software

 “””””””””

Option Explicit

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _(ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _(ByVal hwnd As Long, ByVal nIndex As Long) As Long

Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _(ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long

Private Declare Function DrawMenuBar Lib "user32" (ByVal hwnd As Long) As Long

Private Const GWL_STYLE As Long = (-16)


“””””””””””””””””“”””””””””””””””””””””


Private Sub CommandButtonStm_Cancel_Click()

On Error Resume Next 

ActiveWorkbook.Save

ActiveWorkbook.Close 

Unload Me 

End Sub

 “””””””””””””””””””””“”””””””””””””””””” 

Private Sub CommandButtonStm_Login_Click()

If Me.TextBoxStm_User_Name.Value = "Admin" And Me.TextBoxStm_Password.Value = "321" Then

MsgBox "WELCOME" 

UserFormMenu.Show 

Unload Me 

Else 

MsgBox "Please Try Again" 

Me.TextBoxStm_User_Name.Value = "" Me.TextBoxStm_Password.Value = "" 

End If

End Sub 


“”””””””””””””””””””””””””””””””””””””””“””””””””””””””””””””””””””””””””””

Private Sub UserForm_Initialize()

On Error Resume Next

Dim frm As Long

Dim wHandle As Long

wHandle = FindWindow(vbNullString, Me.Caption)

frm = GetWindowLong(wHandle, GWL_STYLE)

SetWindowLong wHandle, -16, 0 

DrawMenuBar wHandle 

End Sub


“”””””””””””””””””””””””””””””””””””””



Full code PDF download 

Click here 









Monday, 29 July 2024

How to Shut down your computer using user form command button // Shut down your computer using VBA code

 Follow the below Number steps for shut down your computer directly when you click the command button. If you want to know how to create a Command Button then open the MS Excel and fallow step.

A) open developer tab

      If developer tab is not look then click the MS Office logo and click the Excel options and check ✅ show Developer tab in the Ribbon .





B) click the Visual Basic.



C) click the Insert User Form 



D) select the command button in open Tool Box and draw the command button in open User Form.



Step 1:- 

            First you create a Command Button in MS Excel User Form. Then dibble click the command button.


Step 2:-

           Write the below code 



Start code 

On error resume next 

Activeworkbook.save

Application.DisplayAlert = false 

Application.Quit

Shell " Shutdown -s -t 30 "

End code 


Step 3:-

             When you complete the code , then click the run command. Your MS Excel sheet save automatically in your computer and other functions is closed automatically within 30 seconds and your computer is Shut down properly.



Monday, 13 March 2023

MS Excel User form title bar hide modules/# Hide user form title bar using VBA

 Home Page

       M S Excel User Form title bar close icon is the main facts to need the title bar hide. When you run the VBA in visual studio then title bar is open and close icon works is that to close the user form but not the active workbook, when you click the close icon the user form is close but work book and work sheet is not close , again when you open the user form then show the error, solving this error to need the hide title bar of user form and make its own command button to close the user form and work sheet also.

It is two part to write the code 

1. Scripting codes 

2. User Form ittlizied module 

1. Scripting codes:-

Start scripting codes in user form top

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _

    (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _

    (ByVal hwnd As Long, ByVal nIndex As Long) As Long

Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _

    (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long

Private Declare Function DrawMenuBar Lib "user32" (ByVal hwnd As Long) As Long

Private Const GWL_STYLE As Long = (-16)

Close module 

2. Open User Form ittlizied module:-

                                                                      when you write the scripting module then you write the ittlizied module. 

Start module 

Dim frm As Long

Dim wHandle As Long

wHandle = FindWindow(vbNullString, Me.Caption)

frm = GetWindowLong(wHandle, GWL_STYLE)

SetWindowLong wHandle, -16, 0

DrawMenuBar wHandle 

Close module 


Some other topics:-

1. TextBox change Module 

2. Who to Solved Script Error in MS Excel 

3. Use Vlookup Formula in MS Excel UserForm TextBox 

4. Who to Lock your MS Excel File 

5. MS Excel UserForm Save And Edit Module Part-1 

6. MS Excel UserForm Save And Edit Module Part-2 

7. TextBox Enter module. 



Saturday, 4 February 2023

Who to add Suggestion value in TextBox //# TextBox Enter module

 HOME PAGE 

Discuss points:-

1. What is TextBox Enter 

2. Working process of TextBox Enter Module 

3. Use of TextBox Enter Module 

4. TextBox Enter Module

1. What is TextBox Enter:-

                                               According to name TextBox Enter is help to Enter the Data in TextBox According to given conditions.  This process is not automatically but when you goto the TextBox then TextBox values is Automatically Enter.  Different between TextBox change and TextBox Enter Module is that,  TextBox change Module applies TextBox change the other TextBox values but TextBox Enter Module is not charged other TextBox values. 

2. Working process of TextBox Enter Module:-

               Working process of TextBox Enter Module is not automatically but it is Samy automatically process, like according to your condition TextBox values change when you go to the TextBox.  He works just like a suggestion values to help the Enter data. 

3. Use of TextBox Enter Module:- 

                                                               TextBox Enter Module is helpful for checking dummy data.  Like if you can enter data is already then he Enter the Data otherwise he When you goto conditional TextBox,  TextBox values is sow in the TextBox. 

4. TextBox Enter Module:-

                                                  Difference between TextBox change Module and TextBox Enter Module is that,  TextBox change Module applies in other effective TextBox but TextBox Enter Module is same effective TextBox. 

Example:-

               Let take a TextBox and names is , TextBox1 and TextBox2 given a conditions is that,  if TextBox1 values is A then suggested values of TextBox2 show Yes otherwise show Not Matching. 

TextBox2 dubbed click and select the Enter Module and write the below code. 

Start code 

If me.textbox1.value = "A" then 

Me.textbox2.value = "Yes"

Else 

Me.textbox2.value = "Not Matching "

End If 

End Module 

Some other topics:-

1. TextBox change Module 

2. Who to Solved Script Error in MS Excel 

3. Use Vlookup Formula in MS Excel UserForm TextBox 

4. Who to Lock your MS Excel File 

5. MS Excel UserForm Save And Edit Module Part-1 

6. MS Excel UserForm Save And Edit Module Part-2 

7. Who to hide MS Excel User Form title bar 


Wednesday, 1 February 2023

Who to change Textbox value without using command button //# Textbox Change module

 HOME PAGE 

Discuss points:-

1. What is TextBox change 

2. Working process of TextBox Change Module 

3. Use of TextBox Change Module 

4. TextBox Change Module 

1. What is TextBox Change:-

                                                     When one TextBox values is dependent upon a another TextBox values is called TextBox change. TextBox change process is work automatically.  If TextBox values is charged then another TextBox TextBox values change according to given conditions. 

2. Working process of TextBox change Module:-

                  TextBox change Module work is so different becouse when you inter the one TextBox values, another TextBox values change according to the given conditions eminently without press any command button. 

3. Use of TextBox Change Module:-

                                                                 TextBox change Module is automatically data filling method, like we thought that copy data filling check in your form then use the TextBox change Module. 

 Example :-

                    Take the four TextBox like name is TextBox1, TextBox2,TextBox3 and TextBox4 we think when you fill the TextBox1 value the all of the other TextBox change according to your given condition.  

4. TextBox change Module:-

                                                     TextBox change Module is so easy but we know that who the TextBox like working controller. 

If your TextBox values change according to TextBox1 value then Double Click the TextBox1 and Write the code written below.  

Start code

If me.TextBox1.value = 1 then

Me.TextBox2.value = 50 

Else 

Me.TextBox2.value = 100

End If 

End code  

Syntex of the above codes:-

                                                    TextBox2 value is already filled 100 but when you fill the TextBox1 value 1 then TextBox2 value is charged and write 50 automatically without clicking command button. 

Some other topics:-

1. TextBox Enter Module 

2. Who to Solved Script Error in MS Excel 

3. Who to Lock your MS Excel File 

4. MS Excel UserForm Save And Edit Module Part-1 

5. MS Excel UserForm Save And Edit Module Part-2 

6. Who to hide MS Excel User Form title bar 

Monday, 18 July 2022

Who to Solved Script error in MS Excel UserForm Web browser

 HOME PAGE

   UPSC :-The Crown Role (1853-1947)          The East India Company Role (1773-1858)          Information Fusion Center-Indian Ocean Region (IFC-IOR)         Respiratory Syncytial virus (RSV)         Civil Service Previous year Exam Paper PDF          UPSC Prelims 2021 Paper Analysis I Indian Polity             UPSC Prelims 2021 Paper Analysis I Science & Technology                 UPSC Prelims 2021 Paper Analysis I Geography             IAS/PCS Essay Book  Paper Notice and syllabus :PET EXAMINATION SYLLABUS            PET QUESTION PAPER                 SINDHU GHATI SABHYATA                         GST                     B.Ed Second Year Book -2021                            DIGITAL INDIA                    CHILD LABOUR IN INDIA  Competitive Book :- Chemistry Book PDF               GK/GS Book 2021                              All Competitive Maths Book                    All Competitive Resigning Book            Important Project :-  Who to Solved Script Error in MS Excel          Who to Lock your MS Excel File         Tailly Erp 9 Accountig Tips      Visual Studio C # Project      Tally Erp9 Account Feature      Microsoft  Excel VBA Project                    who to  apply mathematical Formula in ms excel user form                   MS Excel UserForm Save And Edit Button Part-1 Module          MS Excel UserForm Save And Edit Button Part-2 Module          Use Vlookup Formula in MS Excel UserForm     Purvanchal University Book :  Purvanchal University Sure Series Book pdf Youtube Class Note :    UP B.Ed Science Entrance Book 2022 Note         Maths Class Note   TGT/PGT Note and Previous Year paper :    TGT/PGT Syllabul 2022           TGT/PGT Previous year solved paper           TGT/PGT Chemistry Note :    TGT/PGT Chemistry Note         Vipin Sir Class Test     ✹ Second Test Class-9    Fist Test Class 7    Fist Test Class-9           Class-9 Test-1 Solution        Class-7 Test-1 Solution 

Total three type point to discuss about it .

1. Who to open Web Browser in MS Excel User Form :-

                                                                                          In this point I would solved the problem in step by step.

Step 1. :-

              The fist problem is that web browser in not add in toolbox Then Go to the toolbox and Right click Just like the given picture.


Open the window just like The given above . Then click the Additional Controls . when you click the Additional Controls Then new window open like it.


when Available control window is open then click the Microsoft web browser . when you check the Microsoft web browser , web browser icon is add in the toolbox.

Step 2.:-

              when web browser is add in the too box then  design the user form . Like UserForm name is UserForm1 and web Browser name is web Browser 1 and make a TextBox name is TextBox 1 and command button name is CommandButton1 .

Design is show like below windows.


whit area is web browser area .

2. Who to code to open the Web Browser :-

                                                                    Double click the Search Command Button and write the code given below.

Private Sub CommandButton1_Click()

Me.WebBrowser1.Navigate Me.TextBox1.Value

End Sub

 When you write the code and save the module . Then Run the UserForm your web Browser in ready to show the content.

                                

3. Solved the Script error :-

                                           When you run your side in the web browser , browser show the Script Error.

Solved this problem go to the user form and click the web browser the go to the properties, and 

Silent properties and Register Browser properties have is True . your Script Error is gown and your web browser work fast .


Some other topics:-

1. TextBox change Module 

 2. TextBox Enter Module 

3. Who to Lock your MS Excel File 

4. MS Excel UserForm Save And Edit Module Part-1 

5. MS Excel UserForm Save And Edit Module Part-2 

6. 

Thursday, 24 March 2022

Use Vlookup formula in user form TextBox

 HOME PAGE    

   UPSC :-UPSC Prelims 2021 Paper Analysis I Indian Polity             UPSC Prelims 2021 Paper Analysis I Science & Technology                 UPSC Prelims 2021 Paper Analysis I Geography             IAS/PCS Essay Book  Paper Notice and syllabus :PET EXAMINATION SYLLABUS            PET QUESTION PAPER                 SINDHU GHATI SABHYATA                         GST                     B.Ed Second Year Book -2021                            DIGITAL INDIA                    CHILD LABOUR IN INDIA  Competitive Book :- GK/GS Book 2021                              All Competitive Maths Book                    All Competitive Resigning Book            Important Project :-Visual Studio C # Project      Tally Erp9 Account Feature      Microsoft  Excel VBA Project                    who to  apply mathematical Formula in ms excel user form                   MS Excel UserForm Save And Edit Button Part-1 Module          MS Excel UserForm Save And Edit Button Part-2 Module          Use Vlookup Formula in MS Excel UserForm     Purvanchal University Book :  Purvanchal University Sure Series Book pdf Youtube Class Note :  Maths Class Note

                                      


                                            Vlookup Formula :-

                                                                                Vlookup Formula is using the Filter the data in the data sheet . When You make the data sheet Then the so complication Work is search the write data in the data sheet . In this Problem solve by Vlookup using Formula.

Example :- 

                    I go to a new MS Excel Sheet and put the name of sheet is "Data" , and make  a Employee table like name, id , password, address, mobile number etc. Tell me dray a user form to using MS Excel VBA . I am put the name of Employee in the Combobox and Click the Command Button Refresh , All the Detail of Employee fill the other Textboxs.

Solution :- 

                           Sheet name   =  "Data"  

                          UserForm name = "Refresh Data" 

                         ComboBox name = ComboBoxEmployee_Name

                          TextBox 1 name = TextBoxEmployee_Id

                          TextBox 2 name = TextBoxEmployee_Address

                          TextBox 3 name = TextBoxEmployee_Mobile_Number

                          Command Button 1 name = CommandButton_Refresh


Private Sub CommandButtonRefresh_Click()

Dim TableArray As Range, Employee Name As String

Set TableArray = Sheets("Data").Range("A:B")

Me.TextBoxEmployee_Id.Value =          WorksheetFunction.VLookup(Me.ComboBoxEmployee_Name, TableArray, 2, 0)

Me.TextBoxEmployee_Address.Value = WorksheetFunction.VLookup(Me.ComboBoxEmployee_Name, TableArray, 3, 0)

Me.TextBoxEmployee_Mobile_Number.Value = WorksheetFunction.VLookup(Me.ComboBoxEmployee_Name, TableArray, 4, 0)


End Sub




                                         2. Add Item In ComboBox :-

                                                                                          ComboBox using the checkout of Repeated entry . This Box is help the new data entry and worn the copy data . ComboBox is make the data Entry is Easy and fast. 

Example :- 

                    Make the ComboBox in UserForm and fix the list data in the data sheet . In this work  UserForm_Initialize code is help to show the data in comboBox list. It is complete the two step to codding fist is  Sub Product_List()  and second is Private Sub UserForm_Initialize()

                             Sheet name   =  "Data"  

                          UserForm name = "Refresh Data" 

                         ComboBox name = ComboBoxEmployee_Name

Coding fist :-

                   It the codding of show the data in the comboBox list when we run the Program.

Private Sub UserForm_Initialize()

Call Product_List

End Sub


Codding Second :-

                                   It is codding of Product list , Whose call in the fist codding module.

   


  Sub Product_List()

Set sh = ThisWorkbook.Sheets("Data")

Dim i As Integer

Me.ComboBoxEmployee_Name.Clear

Me.ComboBoxEmployee_Name.AddItem ""

For i = 2 To Application.WorksheetFunction.CountA(sh.Range("A:A"))

Me.ComboBoxEmployee_Name.AddItem sh.Range("A" & i)

Next i

End Sub


Some other topics:-

1. TextBox change Module 

2. TextBox Enter Module 

Saturday, 8 January 2022

MS Excel UserForm Save and Edit Button Part-2 Module

    HOME PAGE      

UPSC :-UPSC Prelims 2021 Paper Analysis I Indian Polity             UPSC Prelims 2021 Paper Analysis I Science & Technology                 UPSC Prelims 2021 Paper Analysis I Geography             IAS/PCS Essay Book  Paper Notice and syllabus :PET EXAMINATION SYLLABUS            PET QUESTION PAPER                 SINDHU GHATI SABHYATA                         GST                     B.Ed Second Year Book -2021                            DIGITAL INDIA                    CHILD LABOUR IN INDIA  Competitive Book :- GK/GS Book 2021                              All Competitive Maths Book                    All Competitive Resigning Book            Important Project :-Visual Studio C # Project      Tally Erp9 Account Feature      Microsoft  Excel VBA Project                    who to  apply mathematical Formula in ms excel user form                   MS Excel UserForm Save And Edit Button Part-1 Module          MS Excel UserForm Save And Edit Button Part-2 Module



 1) Save Button Module :-

                                          Let :-  Module

TextBox change Module 

II) Edit Button Module :-

                                         Let :-

                                     MS Excel Work Sheet Name Sale

                                     TextBox1Me.TextBoxPos_Entry_Id

                                     CommandButton1 CommandButtonPosEntryEdit

                                      ListBox1 =  ListBoxPos_Entry_Detail

                                      TextBox1 =   Me.TextBoxPos_Entry_Barcode1

                                     TextBox2 =    Me.TextBoxPos_Entry_Qty1

                                    TextBox3 =      Me.TextBoxPos_Entry_Rate1

                                    TextBox4 =       Me.TextBoxPos_Entry_Discount_Percentage1

                                    TextBox5 =      Me.TextBoxPos_Entry_Discount1

                                    TextBox6 =      Me.TextBoxPos_Entry_Taxtable_Value1

                                    TextBox7 =      Me.TextBoxPos_Entry_Amount1

                                     TextBox8 =     Me.TextBoxPos_Entry_Sales_Man1

Private Sub CommandButtonPosEntryEdit_Click()


'''''''''''validation'''''''''''

 If Me.TextBoxPos_Entry_Barcode1.Value = "" Then

      msgbox "Please Enter the Product Name", vbCritical

      Exit Sub

 End If

 

 If IsNumeric(Me.TextBoxPos_Entry_Qty1.Value) = False Then

     msgbox "Please Enter the Correct Purchase Price", vbCritical

     Exit Sub

End If


If IsNumeric(Me.TextBoxPos_Entry_Rate1.Value) = False Then

     msgbox "Please Enter the Correct Sale Price", vbCritical

     Exit Sub

End If


Dim sh As Worksheet

Set sh = ThisWorkbook.Sheets("Sale")



 

 ''''''''''''Update Data

 Dim lr As Integer

 

 lr = Me.TextBoxPos_Entry_Id.Value

 

 sh.Range("A" & lr + 1).Value = lr

 sh.Range("B" & lr + 1).Value = Me.TextBoxPos_Entry_Barcode1.Value

 sh.Range("C" & lr + 1).Value = Me.TextBoxPos_Entry_Qty1.Value

 sh.Range("D" & lr + 1).Value = Me.TextBoxPos_Entry_Rate1.Value

 sh.Range("E" & lr + 1).Value = Me.TextBoxPos_Entry_Discount_Percentage1.Value

 sh.Range("F" & lr + 1).Value = Me.TextBoxPos_Entry_Discount1.Value

 sh.Range("G" & lr + 1).Value = Me.TextBoxPos_Entry_Taxtable_Value1.Value

 sh.Range("H" & lr + 1).Value = Me.TextBoxPos_Entry_Amount1.Value

 sh.Range("I" & lr + 1).Value = Me.TextBoxPos_Entry_Sales_Man1.Value


 

 

 ''''''''''Clear Boxes

  Me.TextBoxPos_Entry_Barcode1.Value = ""

  Me.TextBoxPos_Entry_Qty1.Value = ""

  Me.TextBoxPos_Entry_Rate1.Value = ""

  Me.TextBoxPos_Entry_Discount_Percentage1.Value = ""

  Me.TextBoxPos_Entry_Discount1.Value = "" 

  Me.TextBoxPos_Entry_Taxtable_Value1.Value = ""

  Me.TextBoxPos_Entry_Amount1.Value = ""

  Me.TextBoxPos_Entry_Sales_Man1.Value = ""


 Call Show_Data

 

 

 msgbox "Product has been Updated in Product Master", vbInformation


End Sub




Private Sub ListBoxPos_Entry_Detail_(ByVal Cancel As MSForms.ReturnBoolean)

     Me.TextBoxPos_Entry_Id.Value = Me.ListBoxPos_Entry_Detail.List(Me.ListBoxPos_Entry_Detail.ListIndex, 0)
 
    Me.TextBoxPos_Entry_Barcode1.Value  =Me.ListBoxPos_Entry_Detail.List(Me.ListBoxPos_Entry_Detail.ListIndex, 1) 
 
  Me.TextBoxPos_Entry_Qty1.Value = Me.ListBoxPos_Entry_Detail.List(Me.ListBoxPos_Entry_Detail.ListIndex, 2)
 
    Me.TextBoxPos_Entry_Rate1.Value  = Me.ListBoxPos_Entry_Detail.List(Me.ListBoxPos_Entry_Detail.ListIndex, 3)

 Me.TextBoxPos_Entry_Discount_Percentage1.Value = Me.ListBoxPos_Entry_Detail.List(Me.ListBoxPos_Entry_Detail.ListIndex, 4) 
 
  Me.TextBoxPos_Entry_Discount1.Value  = Me.ListBoxPos_Entry_Detail.List(Me.ListBoxPos_Entry_Detail.ListIndex, 5)
 
  Me.TextBoxPos_Entry_Taxtable_Value1.Value  = Me.ListBoxPos_Entry_Detail.List(Me.ListBoxPos_Entry_Detail.ListIndex, 6)

   Me.TextBoxPos_Entry_Amount1.Value  = Me.ListBoxPos_Entry_Detail.List(Me.ListBoxPos_Entry_Detail.ListIndex, 7)
   
    Me.TextBoxPos_Entry_Sales_Man1.Value = Me.ListBoxPos_Entry_Detail.List(Me.ListBoxPos_Entry_Detail.ListIndex, 8)



End Sub



Some other topics:- 










Friday, 7 January 2022

MS Excel UserForm Save and Edit Button Part-1 Module

     HOME PAGE    

UPSC :-UPSC Prelims 2021 Paper Analysis I Indian Polity             UPSC Prelims 2021 Paper Analysis I Science & Technology                 UPSC Prelims 2021 Paper Analysis I Geography             IAS/PCS Essay Book  Paper Notice and syllabus :PET EXAMINATION SYLLABUS            PET QUESTION PAPER                 SINDHU GHATI SABHYATA                         GST                     B.Ed Second Year Book -2021                            DIGITAL INDIA                    CHILD LABOUR IN INDIA  Competitive Book :- GK/GS Book 2021                              All Competitive Maths Book                    All Competitive Resigning Book            Important Project :-Visual Studio C # Project      Tally Erp9 Account Feature      Microsoft  Excel VBA Project                    who to  apply mathematical Formula in ms excel user form                   MS Excel UserForm Save And Edit Button Part-1 Module          MS Excel UserForm Save And Edit Button Part-2 Module


Save Button Module :-

                                    Fist Create a  table in ms excel user form .  And Set all the Text Boxes Properties.

as like instruction . In this module fist three line is the module of massage. Next of  line in this program is set the Text box filling check up .  

The Next process is that Add the data in the ms excel data sheets. if the data is complete Adding process then the massage box is open . Click the yes Button in the massage box Data is Add successfully.

       User Form Text boxes properties is write below. 


  1) Save Button Module :-

                                          Let :- 

                                      MS Excel Table Sheet Name = Sale

                                      ListBox1 =  ListBoxPos_Entry_Detail

                                      TextBox1 =   Me.TextBoxPos_Entry_Barcode1

                                     TextBox2 =    Me.TextBoxPos_Entry_Qty1

                                    TextBox3 =      Me.TextBoxPos_Entry_Rate1

                                    TextBox4 =       Me.TextBoxPos_Entry_Discount_Percentage1

                                    TextBox5 =      Me.TextBoxPos_Entry_Discount1

                                    TextBox6 =      Me.TextBoxPos_Entry_Taxtable_Value1

                                    TextBox7 =      Me.TextBoxPos_Entry_Amount1

                                     TextBox8 =     Me.TextBoxPos_Entry_Sales_Man1

                                    CommandButton1 = CommandButtonPos_Entry_Save


Private Sub CommandButtonPos_Entry_Save_Click()


Dim MsgValue As VbMsgBoxResult

MsgValue = MsgBox("Do You Want to save the Date?", vbYesNo + vbInformation, "Confirmation")

If MsgValue = vbNo Then Exit Sub


 '''''''''''validation'''''''''''


  If Me.TextBoxPos_Entry_Barcode1.Value = "" Then

      MsgBox "Please Enter the Barcede", vbCritical

       

      Exit Sub

 End If

 

 If IsNumeric(Me.TextBoxPos_Entry_Qty1.Value) = False Then

     MsgBox "Please Enter the Wright Qty", vbCritical

   

     

     Exit Sub

End If


If IsNumeric(Me.TextBoxPos_Entry_Rate1.Value) = False Then

     MsgBox "Please Enter the wright Rate", vbCritical

     Exit Sub

End If


 

 ''''''''''''Add Data

 Dim lr As Integer

 Set sh = ThisWorkbook.Sheets("Sale")

 

 ''1

 

 lr = Application.WorksheetFunction.CountA(sh.Range("A:A"))

 sh.Range("A" & lr + 1).Value = lr

 sh.Range("B" & lr + 1).Value = Me.TextBoxPos_Entry_Barcode1.Value

 sh.Range("C" & lr + 1).Value = Me.TextBoxPos_Entry_Qty1.Value

 sh.Range("D" & lr + 1).Value = Me.TextBoxPos_Entry_Rate1.Value

 sh.Range("E" & lr + 1).Value = Me.TextBoxPos_Entry_Discount_Percentage1.Value

 sh.Range("F" & lr + 1).Value = Me.TextBoxPos_Entry_Discount1.Value

 sh.Range("G" & lr + 1).Value = Me.TextBoxPos_Entry_Taxtable_Value1.Value

 sh.Range("H" & lr + 1).Value = Me.TextBoxPos_Entry_Amount1.Value

 sh.Range("I" & lr + 1).Value = Me.TextBoxPos_Entry_Sales_Man1.Value

 



 '''''''item Clear

 

 Me.TextBoxPos_Entry_Barcode1.Value = ""

 Me.TextBoxPos_Entry_Qty1.Value = ""

 Me.TextBoxPos_Entry_Rate1.Value = ""

 Me.TextBoxPos_Entry_Discount_Percentage1.Value = ""

 Me.TextBoxPos_Entry_Discount1.Value = ""

 Me.TextBoxPos_Entry_Taxtable_Value1.Value = ""

 Me.TextBoxPos_Entry_Amount1.Value = ""

 Me.TextBoxPos_Entry_Sales_Man1.Value = ""


 Call Show_Data


 MsgBox "Product has been added in Product Master", vbInformation


End Sub



 Sub Show_Data()

  Dim sh As Worksheet

 Set sh = ThisWorkbook.Sheets("Sale")

 Dim lr As Integer

 lr = Application.WorksheetFunction.CountA(sh.Range("A:A"))

  If lr = 1 Then lr = 2

 With Me.ListBoxPos_Entry_Detail

 .ColumnCount = 9

 .ColumnHeads = True

 .ColumnWidths = "100,130,130,100,100,100,100,100,100"

 .RowSource = "Sale!A2:I" & lr

 

End With

End Sub


2) Edit Button Module :-

                                        Let :- Module


 Some other topics:-

1. TextBox change Module           

2. TextBox Enter Module  

Thursday, 6 January 2022

Who to apply Mathematical Formula in MS Excel User Form

 HOME PAGE    

UPSC :-UPSC Prelims 2021 Paper Analysis I Indian Polity             UPSC Prelims 2021 Paper Analysis I Science & Technology                 UPSC Prelims 2021 Paper Analysis I Geography             IAS/PCS Essay Book  Paper Notice and syllabus :PET EXAMINATION SYLLABUS            PET QUESTION PAPER                 SINDHU GHATI SABHYATA                         GST                     B.Ed Second Year Book -2021                            DIGITAL INDIA                    CHILD LABOUR IN INDIA  Competitive Book :- GK/GS Book 2021                              All Competitive Maths Book                    All Competitive Resigning Book            Important Project :-Visual Studio C # Project      Tally Erp9 Account Feature      Microsoft  Excel VBA Project                    who to  apply mathematical Formula in ms excel user form                   MS Excel UserForm Save And Edit Button Part-1 Module          MS Excel UserForm Save And Edit Button Part-2 Module


Type of mathematical Formula :-

                                                    1) Addition

                                                    2) Subtraction

                                                    3) Multiplication

                                                    4) Division

                                                    5) Complex


1) Addition :-

                      First of make a Form in MS Excel User Form  . If you do't know that the who to make the User Form then  First of go to the ms Excel windows button . Click the windows button and select the ms excel option button . And Select the Developer Tab option .

When you Select the Developer tab . Developer tab is open in the ms excel title bar.

The Next Process is that Select the Developer tab and go to the Visual Basic option. And Insert the user form .

   Next is fallow in given below :-

                           All the Button is insert Tool box. What type of need.

   

Textbox automatically charged Module Click Here 

             Let :-   TextBox1 =  TextBoxPos_Entry_Qty1

                            TextBox2 =  TextBoxPos_Entry_Qty2

                            TextBox3 =  TextBoxPos_Entry_Qty3

                            TextBox4 =  TextBoxPos_Entry_Total_Qty

                         CommandButton1 =  CommandButtonPos_Entry_Add


 

  User Form is Competed Design then Double Click the Add Command button.

       Write the below code:-


 Private Sub CommandButtonPos_Entry_Add_Click()

  TextBoxPos_Entry_Total_Qty.Value = Val(TextBoxPos_Entry_Qty1.Value) +                                                                            Val(TextBoxPos_Entry_Qty2.Value)+                                                                                                       Val(TextBoxPos_Entry_Qty3.Value)                                                                                  

End Sub

 Result :-

                 When Run the Program . Text Box is ready to type the Data . But Not type the Total Qty value .

          All the data is Filling in the Text box and Click the Add . Text Box Total Qty Text Box is automatic Fill the total value. 

All the given description is fallow in the below Mathematical Operation.




2) Subtraction :-

                    Let:- TextBox1 =  TextBoxPos_Entry_Dis1

                            TextBox2 =  TextBoxPos_Entry_Amount

                             TextBox3 =  TextBoxPos_Entry_Total_Amount

                          CommandButton1 =  CommandButtonPos_Entry_Subraction


 Private Sub CommandButtonPos_Entry_Subraction_Click()

  TextBoxPos_Entry_Total_Amount.Value = Val( TextBoxPos_Entry_Amount.Value) - Val( TextBoxPos_Entry_Dis1.Value)                    

End Sub



 3) Multiplication :-

                       Let :-  TextBox1 =  TextBoxPos_Entry_Qty1

                                   TextBox2TextBoxPos_Entry_Rate1

                                   TextBox3 =  TextBoxPos_Entry_Amount

                                  CommandButton1 =  CommandButtonPos_Entry_Multiplication

Private Sub CommandButtonPos_Entry_Multiplication_Click()

 TextBoxPos_Entry_Amount.Value = Val(TextBoxPos_Entry_Qty1.Value) * Val(TextBoxPos_Entry_Rate1.Value)


End Sub

    


4) Division :-

                   Let:-        TextBox1 =  TextBoxPos_Entry_Qty1

                                   TextBox2 = TextBoxPos_Entry_Rate1

                                   TextBox3 =  TextBoxPos_Entry_Amount

                                  CommandButton1 =  CommandButtonPos_Entry_Division

Private Sub CommandButtonPos_Entry_Division_Click()

 TextBoxPos_Entry_Amount.Value = Val(TextBoxPos_Entry_Rate1.Value) / Val(TextBoxPos_Entry_Qty1.Value 


End Sub

                         

5) Complex :-

                     Find the Value of Net Amount Maximum Round 2 if Qty and Rate is given.

                       Let :-

                                TextBox1 =  TextBoxPos_Entry_Qty

                                 TextBox2 = TextBoxPos_Entry_Rate

                                 TextBox3 =  TextBoxPos_Entry_Net_Amount

                                 TextBox4 =  TextBoxPos_Entry_Discount_Percentage

                                  CommandButton1 =  CommandButtonPos_Entry_Complex

                           

Private Sub CommandButtonPos_Entry_Complex_Click()


TextBoxPos_Entry_Net_Amount.Value = ((Round((Val(TextBoxPos_Entry_Qty.Value) * Val(TextBoxPos_Entry_Rate.Value)), 2)) - (((Val(TextBoxPos_Entry_Qty.Value) * Val(TextBoxPos_Entry_Rate.Value)) * Val(TextBoxPos_Entry_Discount_Percentage.Value)) / 100))

End Sub



Note :-
       I)    Copy data in one TextBox to another TextBox.

            Let :-
                                  TextBox1 =  TextBoxPos_Entry_Qty1

                                   TextBox2 = TextBoxPos_Entry_Qty2

                                   TextBox3 =  TextBoxPos_Entry_Qty3

                                   TextBox4 =  TextBoxPos_Entry_Qty4

                                   TextBox5 = TextBoxPos_Entry_Qty5

                                   TextBox6 =  TextBoxPos_Entry_Qty6

                         Qty1, Qty2, Qty3 date copy in Qty4, Qty5, Qty6

                              CommandButton1 =  CommandButtonPos_Entry_Copy 


Private Sub CommandButtonPos_Entry_Copy_Click()


    TextBoxPos_Entry_Qty1.Value =   TextBoxPos_Entry_Qty4.Value
    TextBoxPos_Entry_Qty2.Value =  TextBoxPos_Entry_Qty5.Value
    TextBoxPos_Entry_Qty3.Value = TextBoxPos_Entry_Qty6.Value


End Sub

  
       II) If and Else Statement used in UserForm TaxtBox.

         Let :-
                       TextBox1 =  TextBoxPos_Entry_Qty

                       TextBox2 = TextBoxPos_Entry_Sr_No

                   CommandButton1 =  CommandButtonPos_Entry_Refresh 

 Case I:-  If Refresh Command Button is Click then Sr. No. Show Automatic                       



Private Sub CommandButtonPos_Entry_Refresh_Click()

 If TextBoxPos_Entry_Qty.Value = "" Then
 TextBoxPos_Entry_Sr_No.Value = ""
 Else
 TextBoxPos_Entry_Sr_No.Value = 1
 End If                 

End Sub


Case II:- If Refresh Command Button is Click Then Qty and Rate Given Value is Multiply . When qty and Rate is Not Given Then Amount Value is "" .

          Let:-
                       TextBox1 =  TextBoxPos_Entry_Qty

                       TextBox2 = TextBoxPos_Entry_Rate

                       TextBox3 = TextBoxPos_Entry_Amount

                   CommandButton1 =  CommandButtonPos_Entry_Refresh 



Private Sub CommandButtonPos_Entry_Refresh_Click()


 If TextBoxPos_Entry_Qty.Value = "" Then
TextBoxPos_Entry_Amount .Value = ""
 Else
TextBoxPos_Entry_Amount.Value = Val(TextBoxPos_Entry_Rate.Value) * Val(TextBoxPos_Entry_Qty.Value)
 End If  



Saturday, 4 December 2021

MS Excel VBA Code

 HOME PAGE    

UPSC :-UPSC Prelims 2021 Paper Analysis I Indian Polity             UPSC Prelims 2021 Paper Analysis I Science & Technology                 UPSC Prelims 2021 Paper Analysis I Geography             IAS/PCS Essay Book  Paper Notice and syllabus :PET EXAMINATION SYLLABUS            PET QUESTION PAPER                 SINDHU GHATI SABHYATA                         GST                     B.Ed Second Year Book -2021                            DIGITAL INDIA                    CHILD LABOUR IN INDIA  Competitive Book :- GK/GS Book 2021                              All Competitive Maths Book                    All Competitive Resigning Book            Important Project :-Visual Studio C # Project      Tally Erp9 Account Feature      Microsoft  Excel VBA Project                    who to  apply mathematical Formula in ms excel user form                   MS Excel UserForm Save And Edit Button Part-1 Module          MS Excel UserForm Save And Edit Button Part-2 Module



                   Micro Soft VBA Project


 Table of Contect:-
                              
                                 1.
                               
                                 2. User Form ToolBox
   
                                 3. User Form Properties
 
                                 4. User Form Button Module

                                                                     i) Add Data Module
                                                                  
                                                                     ii) Edit Data Module
 
                                                                     iii) Delete Data Module

                                                                     iv) Next and Preview Module
    
                                                                      v) ListBox Module
 
                                                                      vi) User Form Ittlige Module

                                                                     vii) Currant Data Add Module

                                                                     viii) Preview and Next Button Module


                               5. Log In Form Design
 
                                                                     i) Log in Button Module with security
     
   
                                          
                                              Log In Form Design
                              ..................................................................

let :-
           TextBox1 Name = TextBoxId
         
           TextBox2 Name = TextBoxPassword

           Button1 Name = Log_In

           Button2 Name = Cancel


 Module:-
        

Private Sub CommandButtonLog_In_Click()
       If TextBoxId.Text = "super" And TextBoxPassword.Text = "123" Then
           MsgBox "LogIn successful"
           UserFormMenu.Show

        Else
                
               TextBoxId.Text = ""
               TextBoxPassword.Text = ""
                MsgBox "Log in Incorrect Please Registred your Company"

                UserFormCard_Master.Show


       End If

End Sub
             



                       1)      User Form Preview and Next Button Design
             ......................................................................................................


Let:-

        Toggle Button1 = ToggleButtonPreview
      
         Toggle Button 2 = ToggleButtonNext
         



       Text Box 1 = TextBoxPos_Entry_Id   ...........................(visuality = False)

        Text Box 2 = TextBoxPosEntryBillPrint
       
        Text Box 3 = TextBoxPosEntryBarcode

        Text Box 4 = TextBoxPosEntryQty

       Text Box 5 = TextBoxPosEntryRate

       Text Box 6 = TextBoxPosEntryDisP

        Text Box 7 = TextBoxPosEntryDiscount

        Text Box 8 = TextBoxPosEntrySalesMan




        List Box 1 = ListBoxPos_Entry_Return_Detail




                                          Preview Button Module
                             ........................................................................ 


 Private Sub ToggleButtonPreview_Click()

Dim i As Integer

If Me.TextBoxPos_Entry_Id.Value = "" Then
 msgbox " Please Select a Item"
Exit Sub
End If

i = Me.ListBoxPos_Entry_Return_Detail.ListIndex
    Me.ListBoxPos_Entry_Return_Detail.Selected(i) = True
    
     Me.TextBoxPos_Entry_Id.Value = Me.ListBoxPos_Entry_Return_Detail.Column(0, i - 1)
     Me.TextBoxPosEntryBillPrint.Value = Me.ListBoxPos_Entry_Return_Detail.Column(1, i - 1)
     Me.TextBoxPosEntryBarcode.Value = Me.ListBoxPos_Entry_Return_Detail.Column(3, i - 1)
     Me.TextBoxPosEntryQty.Value = Me.ListBoxPos_Entry_Return_Detail.Column(6, i - 1)
     Me.TextBoxPosEntryRate.Value = Me.ListBoxPos_Entry_Return_Detail.Column(8, i - 1)
     Me.TextBoxPosEntryDisP.Value = Me.ListBoxPos_Entry_Return_Detail.Column(9, i - 1)
     Me.TextBoxPosEntryDiscount.Value = Me.ListBoxPos_Entry_Return_Detail.Column(10, i - 1)
     Me.TextBoxPosEntrySalesMan.Value = Me.ListBoxPos_Entry_Return_Detail.Column(12, i - 1)
    
  Me.ListBoxPos_Entry_Return_Detail.Selected(i - 1) = True
    

End Sub




                                             Next Button Module
                                  .............................................................



Private Sub ToggleButtonNext_Click()

Dim i As Integer
 If Me.TextBoxPos_Entry_Id.Value = "" Then
   msgbox " Please Select the list Item"
Exit Sub
End If

i = Me.ListBoxPos_Entry_Return_Detail.ListIndex
     Me.ListBoxPos_Entry_Return_Detail.Selected(i) = True
     
     Me.TextBoxPos_Entry_Id.Value = Me.ListBoxPos_Entry_Return_Detail.Column(0, i + 1)
     Me.TextBoxPosEntryBillPrint.Value = Me.ListBoxPos_Entry_Return_Detail.Column(1, i + 1)
     Me.TextBoxPosEntryBarcode.Value = Me.ListBoxPos_Entry_Return_Detail.Column(3, i + 1)
     Me.TextBoxPosEntryQty.Value = Me.ListBoxPos_Entry_Return_Detail.Column(6, i + 1)
     Me.TextBoxPosEntryRate.Value = Me.ListBoxPos_Entry_Return_Detail.Column(8, i + 1)
     Me.TextBoxPosEntryDisP.Value = Me.ListBoxPos_Entry_Return_Detail.Column(9, i + 1)
     Me.TextBoxPosEntryDiscount.Value = Me.ListBoxPos_Entry_Return_Detail.Column(10, i + 1)
     Me.TextBoxPosEntrySalesMan.Value = Me.ListBoxPos_Entry_Return_Detail.Column(12, i + 1)
    
  Me.ListBoxPos_Entry_Return_Detail.Selected(i + 1) = True
    

End Sub




                                        List Box Click Module
                             ................................................................



Private Sub ListBoxPos_Entry_Return_Detail_Click()

Dim i As Integer

    i = Me.ListBoxPos_Entry_Return_Detail.ListIndex
    Me.ListBoxPos_Entry_Return_Detail.Selected(i) = True
    
     Me.TextBoxPos_Entry_Id.Value = Me.ListBoxPos_Entry_Return_Detail.Column(0, i)
     Me.TextBoxPosEntryBillPrint.Value = Me.ListBoxPos_Entry_Return_Detail.Column(1, i)
     Me.TextBoxPosEntryBarcode.Value = Me.ListBoxPos_Entry_Return_Detail.Column(3, i)
     Me.TextBoxPosEntryQty.Value = Me.ListBoxPos_Entry_Return_Detail.Column(6, i)
     Me.TextBoxPosEntryRate.Value = Me.ListBoxPos_Entry_Return_Detail.Column(8, i)
     Me.TextBoxPosEntryDisP.Value = Me.ListBoxPos_Entry_Return_Detail.Column(9, i)
     Me.TextBoxPosEntryDiscount.Value = Me.ListBoxPos_Entry_Return_Detail.Column(10, i)
     Me.TextBoxPosEntrySalesMan.Value = Me.ListBoxPos_Entry_Return_Detail.Column(12, i)
   

End Sub







                                2)        Add and Edit Button Module
                     .....................................................................................



  Let :- 
    
                Command Button 1 = CommandButtonPosEntrySave

 

Private Sub CommandButtonPosEntrySave_Click()
Dim MsgValue As VbMsgBoxResult
MsgValue = msgbox("Do You Want to save the Date?", vbYesNo + vbInformation, "Confirmation")
If MsgValue = vbNo Then Exit Sub

 '''''''''''validation'''''''''''
 If Me.TextBoxPosEntryBarcode.Value = "" Then
      msgbox "Please Enter the Product Name", vbCritical
      Exit Sub
 End If
 
 If IsNumeric(Me.TextBoxPosEntryQty.Value) = False Then
     msgbox "Please Enter the Correct Purchase Price", vbCritical
     Exit Sub
End If

If IsNumeric(Me.TextBoxPosEntryRate.Value) = False Then
     msgbox "Please Enter the Correct Sale Price", vbCritical
     Exit Sub
End If

 
 ''''''''''''Add Data
 Dim lr As Integer
 Set sh = ThisWorkbook.Sheets("Pos_Entry_Return")
 
 
 lr = Application.WorksheetFunction.CountA(sh.Range("AQ:AQ"))
 sh.Range("AQ" & lr + 1).Value = lr
 sh.Range("AR" & lr + 1).Value = Me.TextBoxPosEntryBillPrint.Value
 sh.Range("AT" & lr + 1).Value = Me.TextBoxPosEntryBarcode.Value
 sh.Range("AW" & lr + 1).Value = Me.TextBoxPosEntryQty.Value
 sh.Range("AY" & lr + 1).Value = Me.TextBoxPosEntryRate.Value
 sh.Range("AZ" & lr + 1).Value = Me.TextBoxPosEntryDisP.Value
 sh.Range("BA" & lr + 1).Value = Me.TextBoxPosEntryDiscount.Value
 sh.Range("BC" & lr + 1).Value = Me.TextBoxPosEntrySalesMan.Value

 
 
 
 
 
 ''''''''''Clear Boxes
 Me.TextBoxPosEntryBillPrint.Value = ""
 Me.TextBoxPosEntryBarcode.Value = ""
 Me.TextBoxPosEntryQty.Value = ""
 Me.TextBoxPosEntryRate.Value = ""
 Me.TextBoxPosEntryDisP.Value = ""
 Me.TextBoxPosEntryDiscount.Value = ""
 Me.TextBoxPosEntrySalesMan.Value = ""

 
 
 
 Call Show_Data
 
 
 msgbox "Product has been added in Product Master", vbInformation
 
 End Sub
 
 


                                 Show Data in List Box Module
                   .................................................................................
 

Sub Show_Data()
 
 Dim sh As Worksheet
 Set sh = ThisWorkbook.Sheets("Pos_Entry_Return")
 
 Dim lr As Integer
 lr = Application.WorksheetFunction.CountA(sh.Range("AQ:AQ"))
 
 
 If lr = 1 Then lr = 2
 
 
 With Me.ListBoxPos_Entry_Return_Detail
 .ColumnCount = 14
 .ColumnHeads = True
 .ColumnWidths = "50,50,50,100,130,130,100,100,100,100,100,100,80,80"
 .RowSource = "Pos_Entry_Return!AQ2:BE" & lr
 
End With

 
 End Sub


                                      List Box Dubble Click Module
                           .......................................................................


Private Sub ListBoxPos_Entry_Return_Detail_DblClick(ByVal Cancel As MSForms.ReturnBoolean)

     Me.TextBoxPos_Entry_Id.Value = Me.ListBoxPos_Entry_Return_Detail.List(Me.ListBoxPos_Entry_Return_Detail.ListIndex, 0)
     Me.TextBoxPosEntryBillPrint.Value = Me.ListBoxPos_Entry_Return_Detail.List(Me.ListBoxPos_Entry_Return_Detail.ListIndex, 1)
     Me.TextBoxPosEntryBarcode.Value = Me.ListBoxPos_Entry_Return_Detail.List(Me.ListBoxPos_Entry_Return_Detail.ListIndex, 3)
     Me.TextBoxPosEntryQty.Value = Me.ListBoxPos_Entry_Return_Detail.List(Me.ListBoxPos_Entry_Return_Detail.ListIndex, 6)
     Me.TextBoxPosEntryRate.Value = Me.ListBoxPos_Entry_Return_Detail.List(Me.ListBoxPos_Entry_Return_Detail.ListIndex, 8)
     Me.TextBoxPosEntryDisP.Value = Me.ListBoxPos_Entry_Return_Detail.List(Me.ListBoxPos_Entry_Return_Detail.ListIndex, 9)
     Me.TextBoxPosEntryDiscount.Value = Me.ListBoxPos_Entry_Return_Detail.List(Me.ListBoxPos_Entry_Return_Detail.ListIndex, 10)
     Me.TextBoxPosEntrySalesMan.Value = Me.ListBoxPos_Entry_Return_Detail.List(Me.ListBoxPos_Entry_Return_Detail.ListIndex, 12)
   
  


End Sub


                                 User Form Click Module
                       ...................................................................  

Private Sub UserForm_Activate()
Call Show_Data

End Sub

 
            UserForm_Initialize Module ( Show Current Date Module)
      ....................................................................................................................

Private Sub UserForm_Initialize()

Me.TextBoxTaxtable_Bill_Date.Value = Format(Date, "D-MMM-YYYY")

Call Add_Product_List


End Sub


                                   CamboBox Product List Module
                        ............................................................................

Let :-
         CamboBox1 = ComboBoxItem_Grade
         CamboBox 2 = ComboBoxHsn_Code



Sub Add_Product_List()
Set sh = ThisWorkbook.Sheets("Product")

Dim i As Integer

Me.ComboBoxItem_Grade.Clear
Me.ComboBoxItem_Grade.AddItem ""
 For i = 2 To Application.WorksheetFunction.CountA(sh.Range("A:A"))
       Me.ComboBoxItem_Grade.AddItem sh.Range("B" & i)

Next i

Set dsh = ThisWorkbook.Sheets("Product")

Dim j As Integer

Me.ComboBoxHsn_Code.Clear
Me.ComboBoxHsn_Code.AddItem ""
 For j = 2 To Application.WorksheetFunction.CountA(sh.Range("A:A"))
     Me.ComboBoxHsn_Code.AddItem dsh.Range("F" & j)
    
Next j





End Sub






                                Edit Button Module
                      ........................................................
 
Let :
             Command Button 2 = CommandButtonPosEntryEdit
  

Private Sub CommandButtonPosEntryEdit_Click()

'''''''''''validation'''''''''''
 If Me.TextBoxPosEntryBarcode.Value = "" Then
      msgbox "Please Enter the Product Name", vbCritical
      Exit Sub
 End If
 
 If IsNumeric(Me.TextBoxPosEntryQty.Value) = False Then
     msgbox "Please Enter the Correct Purchase Price", vbCritical
     Exit Sub
End If

If IsNumeric(Me.TextBoxPosEntryRate.Value) = False Then
     msgbox "Please Enter the Correct Sale Price", vbCritical
     Exit Sub
End If

Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("Pos_Entry_Return")


 
 ''''''''''''Update Data
 Dim lr As Integer
 
 lr = Me.TextBoxPos_Entry_Id.Value
 
 sh.Range("AQ" & lr + 1).Value = lr
 sh.Range("AR" & lr + 1).Value = Me.TextBoxPosEntryBillPrint.Value
 sh.Range("AT" & lr + 1).Value = Me.TextBoxPosEntryBarcode.Value
 sh.Range("AW" & lr + 1).Value = Me.TextBoxPosEntryQty.Value
 sh.Range("AY" & lr + 1).Value = Me.TextBoxPosEntryRate.Value
 sh.Range("AZ" & lr + 1).Value = Me.TextBoxPosEntryDisP.Value
 sh.Range("BA" & lr + 1).Value = Me.TextBoxPosEntryDiscount.Value
 sh.Range("BC" & lr + 1).Value = Me.TextBoxPosEntrySalesMan.Value

 
 
 
 
 ''''''''''Clear Boxes
 Me.TextBoxPosEntryBillPrint.Value = ""
 Me.TextBoxPosEntryBarcode.Value = ""
 Me.TextBoxPosEntryQty.Value = ""
 Me.TextBoxPosEntryRate.Value = ""
 Me.TextBoxPosEntryDisP.Value = ""
 Me.TextBoxPosEntryDiscount.Value = ""
 Me.TextBoxPosEntrySalesMan.Value = ""

 
 
 Call Show_Data
 
 
 msgbox "Product has been Updated in Product Master", vbInformation




End Sub

 
                    

Student management Data Entry Based Application Software

 “”””””””” Option Explicit Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _(ByVal lpClassName As S...