Be seen. Boost your question’s priority for more expert views and faster solutions
If r.Value > Now() Then MsgBox ("Future dates not allowed!")
But the error occurs at the following line, am I correct?If Not Intersect(Target, range("C2")) Is Nothing Then
Have you set Target as a range?
Set target = Sheet21.Range("C2")
If Intersect(target, Range("C2")) > 0 Then
End if
Set r = Sheet21.Range("C2")
If DateSerial(Left(r, 4), Mid(r, 5, 2), Mid(r, 7, 2)) <> DateValue(Now) Then MsgBox ("File not today")
Set ws = Application.ActiveSheet
Set r = ws.Range("C2")
If DateSerial(Left(r, 4), Mid(r, 5, 2), Mid(r, 7, 2)) <> DateValue(Now) Then MsgBox ("File not today")
orSet r = Sheet21.Range("C2")
If DateSerial(Left(r, 4), Mid(r, 5, 2), Mid(r, 7, 2)) <> DateValue(Now) Then MsgBox ("File not today")
If you want to read cell C2 from the active sheet, you can use the first.Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Also, try today(). Definitely works in word, not sure about excel.