Excel pop-up when date is changed if value of another cell is YES

AdrianWebb

New Member
Joined
Jun 14, 2022
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Good morning/afternoon/evening,

Admittedly, I am not very computer savvy, but I have an Excel puzzle that I can't solve. I want a pop-up box to come up with a message that says "Please input audit data into Audit Sheet" whenever a date in column G is changed IF "YES" has been chosen in the cell in column E of the same row. So, for example, if the date in G5 is changed AND "YES" has been selected in E5, then the pop-up message should appear. Or if the date in G22 is changed AND "YES" has been selected in E22, then the pop-up message appears. From what I have read, I think that I will need to use VBA code to do this, but I know nothing about coding and couldn't find this exact situation to modify someone else's code.

Thank you in advance for sharing your skills!
Adrian
 

Attachments

  • Excel spreadsheet.png
    Excel spreadsheet.png
    161.4 KB · Views: 9

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Hi
I'm not sure if this is what you want . just test it
put the code in worksheet module not standard module , be careful.
VBA Code:
Private Sub Worksheet_change(ByVal Target As Range)
If Target.Cells.CountLarge > 1 Then Exit Sub
If Target.Column = 5 Then
If Target.Value = "yes" Then
    MsgBox "the date has been changed in cell" & " " & Target.Offset(, 2).Address & VBA.vbCrLf & " the  date is " & Target.Offset(, 2).Value, vbExclamation
End If
End If
End Sub
 
Upvote 0
Hmm, it didn't work unfortunately. Do I need to add references to this code for the column/row or just copy/paste the code exactly as written. As I said before, I am computer illiterate!! I appreciate you taking the time to look at it and apologize for my slow response.
 
Upvote 0
Hi
I'm not sure if this is what you want . just test it
put the code in worksheet module not standard module , be careful.
VBA Code:
Private Sub Worksheet_change(ByVal Target As Range)
If Target.Cells.CountLarge > 1 Then Exit Sub
If Target.Column = 5 Then
If Target.Value = "yes" Then
    MsgBox "the date has been changed in cell" & " " & Target.Offset(, 2).Address & VBA.vbCrLf & " the  date is " & Target.Offset(, 2).Value, vbExclamation
End If
End If
End Sub
Hmm, it didn't work unfortunately. Do I need to add references to this code for the column/row or just copy/paste the code exactly as written. As I said before, I am computer illiterate!! I appreciate you taking the time to look at it and apologize for my slow response.
 
Upvote 0
for example, if the date in G5 is changed AND "YES" has been selected in E5
some questions

where did you put the code?

ok right click on tab you have data and paste the code when open vba editor as in attached picture
based on picture should put the code into sheet1 module

do you write date manually also YES ?

do you have formula when write date should fill yes?

dfg.PNG
 
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,194
Members
453,021
Latest member
pingpong7117

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top