Ark68
Well-known Member
- Joined
- Mar 23, 2004
- Messages
- 4,564
- Office Version
- 365
- 2016
- Platform
- Windows
I have a cell on my worksheet that gets autopopulated with a value. The user can access the cell and change the value (a date).
I'm looking for some help in error checking. The value entered can only be a date, and it can only be a Friday. If it isn't, I'd like the cell to return to it's original value. Is this possible. I want to think it has something to do with "Cancel" but I don't know how touse it in this situation.
Here is my code ...
Is anyone able to help me find a solution to return the original value to D4. I think I can use "isdate" to determine if the value the user entered is indeed a date vs. text or some redundant entry.
I'm looking for some help in error checking. The value entered can only be a date, and it can only be a Friday. If it isn't, I'd like the cell to return to it's original value. Is this possible. I want to think it has something to do with "Cancel" but I don't know how touse it in this situation.
Here is my code ...
VBA Code:
Private Sub worksheet_change(ByVal Target As Range)
If Target.Address = "$C$4" Then
uidate = Target.Value 'user inpute date
If Weekday(uidate) <> 6 Then 'date entered isn't a friday
'can only be a friday. Return original value to cell C4
End If
End If
End Sub
Is anyone able to help me find a solution to return the original value to D4. I think I can use "isdate" to determine if the value the user entered is indeed a date vs. text or some redundant entry.