How to Confirm Data Entry Values in an Excel Worksheet Using VBA

We often wish that the data entries we make in an Excel worksheet are error free. There are are many ways to achieve this like for example using data validation. But data validation has its own limitations. Now we can use Excel VBA and have the user confirm his data entry so that he is forced to check it. The complete code is given below to check the unit price of items in column B or 2:

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Target.Column = 2 Then
confirm = MsgBox(“Do you wish to confirm entry of this data?”, vbYesNo, “confirm Entry”)
Select Case confirm
Case Is = vbYes
Case Is = vbNo
End Select
End If
Application.EnableEvents = True
End Sub

Watch the revised Excel training video below to understand the concept:

7 thoughts on “How to Confirm Data Entry Values in an Excel Worksheet Using VBA

  1. chander shekhar

    what is code if we have to enter data in more than one column.what is code if target.column is more than one column says column bto f

  2. Pingback: Automatically Password Protect Excel Worksheet and Lock Cells after Data Entry using VBA | Excel VBA Training Videos

  3. arvind kumar

    how to print the multiple select Multiple invoice data in sheet 1 to selected format in sheet 2 by the print button

  4. Adad M. Cherif

    Hello, Dr. Kumar Takyar
    Thank you for all your lessons on the VBA

    How to transfer data from more than one worksheet to the same userform. For example, if I click on a commandbutton1 all data are transferred from sheet 1 to the textbox of the userform1.and if I click on commandbutton2, all data are transferred from sheet 2 to the txtbox of the same userform1. ( It means 2 different sheets and one userform).

    With best regards

    Prof. Adad M. Cherif, Algeria

  5. syed

    hi sir this syed from Hyderabad plz i need your help
    i have approximately 2500 records in excel sheet1 just i want make it in userform but did’nt get how
    i have search same like a vb6.0 Mdb file plz help me
    thanks in advance


Leave a Reply

Your email address will not be published. Required fields are marked *