Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
Need help with VBA code in Excel for clearing contents of cells based on value of another.?
Hello,
I am attempting to clear the contents of a cell by checking for a date change in cell H4, then comparing it to today's date. If it does not equal today's date, then it will clear the signature block which resides in a merged cell G13:J17. After a few iterations, the code below did not produce errors, but also did not clear the contents of G13:J17 when the date was changed in cell H4. I think I'm missing something obvious.
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$H$4" Then
If Range("$H$4") <> Date Then
Range("G13:J17").ClearContents
End If
End If
End Sub
2 Answers
- garbo7441Lv 72 years agoFavorite Answer
Your code, as written, should work for you. It works for me, when tested.
- Anonymous2 years ago
Target.Address is case sensitive, have you used "$h$4" in VBA?