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

Home More Excel (VBA) Training Videos

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:

Watch the video on youtube