Caveman1964
Board Regular
- Joined
- Dec 14, 2017
- Messages
- 127
- Office Version
- 2016
- Platform
- Windows
I have altered this many times. Need it to come back and tell user they didn't enter proper date format.
Currently it allows any text to be entered. I tried many things but at my wits end. I have used suggestions from other date format posts but can't get to quite fit in this.
Codes begins by searching for a number and when it finds it asks to enter date, if one is already there, it says so, if not it allows anything to be put in. would like message to say, "date has been entered" as well.
Any help from you gurus is appreciated.
Sub enterdateintrosurveysent()
Sheets("Do Not Alter").Unprotect "1"
Sheets("Data Collection").Unprotect "1"
Sheets("Complaint Entry").Unprotect "1"
'Modified 11/10/2018 6:23:29 PM EST
Application.ScreenUpdating = False
Dim JobNumber As String
Dim SearchRange As Range
Dim NewDate As String
Sheets("Data Collection").Activate
JobNumber = InputBox("Please enter a Complaint Number", "Company Complaint System")
If Len(JobNumber) < 1 Then msgbox "No Value entered": Exit Sub
Set SearchRange = Range("A:A").find(JobNumber)
If SearchRange Is Nothing Then msgbox "Job number not found", vbExclamation, "Not found": Exit Sub
If Cells(SearchRange.Row, 19).Value = "" Then
NewDate = InputBox("Please enter the date", "Date")
Cells(SearchRange.Row, 19).Value = NewDate
Else
msgbox "The Value " & JobNumber & " Already Exists"
End If
Sheets("Complaint Entry").Select
Application.ScreenUpdating = True
Sheets("Do Not Alter").Protect "1", True, True
Sheets("Data Collection").Protect "1", True, True
Sheets("Complaint Entry").Protect "1", True, True
End Sub
Currently it allows any text to be entered. I tried many things but at my wits end. I have used suggestions from other date format posts but can't get to quite fit in this.
Codes begins by searching for a number and when it finds it asks to enter date, if one is already there, it says so, if not it allows anything to be put in. would like message to say, "date has been entered" as well.
Any help from you gurus is appreciated.
Sub enterdateintrosurveysent()
Sheets("Do Not Alter").Unprotect "1"
Sheets("Data Collection").Unprotect "1"
Sheets("Complaint Entry").Unprotect "1"
'Modified 11/10/2018 6:23:29 PM EST
Application.ScreenUpdating = False
Dim JobNumber As String
Dim SearchRange As Range
Dim NewDate As String
Sheets("Data Collection").Activate
JobNumber = InputBox("Please enter a Complaint Number", "Company Complaint System")
If Len(JobNumber) < 1 Then msgbox "No Value entered": Exit Sub
Set SearchRange = Range("A:A").find(JobNumber)
If SearchRange Is Nothing Then msgbox "Job number not found", vbExclamation, "Not found": Exit Sub
If Cells(SearchRange.Row, 19).Value = "" Then
NewDate = InputBox("Please enter the date", "Date")
Cells(SearchRange.Row, 19).Value = NewDate
Else
msgbox "The Value " & JobNumber & " Already Exists"
End If
Sheets("Complaint Entry").Select
Application.ScreenUpdating = True
Sheets("Do Not Alter").Protect "1", True, True
Sheets("Data Collection").Protect "1", True, True
Sheets("Complaint Entry").Protect "1", True, True
End Sub