Hello all,
I'm trying to write a vba MsgBox that will allow the user to re-enter data into a cell if it was entered incorrectly.
If the user enters data then submits it (by moving to another cell, hitting enter, etc.) and it is not typical data a MsgBox pops up. This box has two buttons 'Retry' and 'Cancel'.
Below is a simplification of my code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim msgboxResult As String
If Target.Column = 1 Then
If Target.Value <> 1 Then
msgboxResult = MsgBox("Are you sure this data is entered correctly?", vbRetryCancel)
If msgboxResult = vbRetry Then
' Retry clicked
' NEED TO GO BACK TO CELL AND RE-ENTER DATA (try again)
Else
' Cancel clicked
Application.EnableEvents = False
Target.Value = 1
Application.EnableEvents = True
End If
End If
End If
End Sub
Two questions:
1. If the user clicks the 'Retry' button on the MsgBox, how can I go back to the calling cell and back into 'entry' mode. I.E. similar to what would happen if validation were on the cell.
2. Is there a way I could get the data from the cell before the user entered/overwrote new data into it?
Thanks to any with ideas 
Damask
Bookmarks