JessWhyCuh
New Member
- Joined
- Jul 10, 2018
- Messages
- 15
Hey all,
A little background on my vba project: When the date in a cell is a past date, the cell style changes to "Bad".
I am trying to code this logic: If you change a past date to today's or a future date, then change a cell in another column, but same row, to the style "Neutral". For some reason this line of code only works with the <, <=, or = operator. It does not work with > or >= operators which is what I need. Why? Or if you know a better way to code this please share because I don't understand why it doesn't work this way. Thank you! Down below is my code:
A little background on my vba project: When the date in a cell is a past date, the cell style changes to "Bad".
I am trying to code this logic: If you change a past date to today's or a future date, then change a cell in another column, but same row, to the style "Neutral". For some reason this line of code only works with the <, <=, or = operator. It does not work with > or >= operators which is what I need. Why? Or if you know a better way to code this please share because I don't understand why it doesn't work this way. Thank you! Down below is my code:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Style = "Bad" And Target.Value>= Date Then Cells(Target.Row, "W").Style = "Neutral"
End Sub