Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Prevent data entry based upon date check

Status
Not open for further replies.

wbow

Technical User
Feb 8, 2005
50
GB
Newbie to VBA, apologies if this seems too simple for words.

I have a spreadsheet and I want to check a date column to ensure that the users cannot enter a date after month end.
I am also being asked to lock the sheet to prevent additions but not deletions.

Cell renge is E5:E100

I have tried

Public sub Validate()

If Worksheets(“Sheet1”).Range(“E5:E100”) < Date Then
MsgBox “Date after month end”, vbOKOnly, Date Check

End If

End sub

Any help would be appreciated.

Thanks,
 




Hi,

Check out Data > Validation. It is an Excel feature. No VBA required.

Skip,

[glasses] When a diminutive clarvoyant had disappeared from detention, headlines read...
Small Medium at Large[tongue]
 
Ockham's Razor!

Many thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top