PDA

View Full Version : [SOLVED] If data entered then prompt



holdit
09-17-2005, 09:20 AM
Hi all

Iam look for a vba that when ANY data is entered in ANY CELL on ROW 10 then prompt me to eg: yes or no

yes = run another vba
no = cancel

Thanks for reply before you havehttp://vbaexpress.com/forum/images/smilies/notworthy.gif

MWE
09-17-2005, 09:51 AM
Hi all

Iam look for a vba that when ANY data is entered in ANY CELL on ROW 10 then prompt me to eg: yes or no

yes = run another vba
no = cancel

Thanks for reply before you havehttp://vbaexpress.com/forum/images/smilies/notworthy.gif
Welcome to the VBAX forum

You probably want to use the Worksheet_Change function. It triggers whenever a change is made to any cell in the target worksheet. You can test what cells were changed and act accordingly.

For your particular case, something like this might work:


Private Sub Worksheet_Change(ByVal Target As Range)
Dim Ans As VbMsgBoxResult
If Target.Row = 10 Then
Ans = MsgBox("do you want to ??? ", vbQuestion + vbYesNo)
Select Case Ans
Case Is = vbYes
MsgBox "user replied YES"
Case Is = vbNo
MsgBox "user replied NO"
End Select
End If
End Sub


This code must be placed in the code module for the target worksheet.

Please let us know if this works and if it solves your problem.

holdit
09-17-2005, 10:35 AM
Top job

Ive tried other over forums with this and got a simular code but it would not work but first time on this forum got the answer and it worked :clap:

Cheers mate :)