I would use two functions:
One function to create the array with valid months - please check the code below: you have to use array not split. Alternatively you could read the valid month names from a worksheet or create the list automatically etc.
One generic function to check if a value is within an array
Option Explicit
Sub testGetMonthsName()
Dim MonthSelected As Variant, arrMonths As Variant
arrMonths = getMonthArray
Re_Enter_NewName:
MonthSelected = InputBox("Please Write Month- Case Sensitive", "MONTH")
If MonthSelected = vbNullString Then
'cancel or empty
Exit Sub
ElseIf isValueInArray(MonthSelected, arrMonths) Then
'MonthSelected is valid
Exit Sub
Else
'MonthSelected is not valid
MsgBox "Please Enter a Month of the Year"
GoTo Re_Enter_NewName:
End If
End Sub
Private Function getMonthArray() As Variant
getMonthArray = Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December")
End Function
Private Function isValueInArray(value As Variant, arrValues As Variant) As Boolean
Dim i As Long
For i = LBound(arrValues) To UBound(arrValues)
If arrValues(i) = value Then
isValueInArray = True
Exit For
End If
Next
End Function
Based on comment from @ChristanBuse - a more advanced version:
Option Explicit
Sub test_getMonthFromUser()
Dim strMonth As String, cancel As Boolean
Do
strMonth = getMonthNameFromUser(cancel)
If cancel = True Then Exit Sub
If isMonthNameValid(strMonth) = False Then
If MsgBox("Please enter a valid month name", vbOKCancel + vbExclamation) = vbCancel Then
Exit Do
Else
strMonth = vbNullString
End If
End If
Loop Until LenB(strMonth) > 0
If LenB(strMonth) > 0 Then
MsgBox "Valid month selected: " & strMonth
End If
End Sub
Private Function getMonthNameFromUser(ByRef cancel As Boolean) As String
Dim strMonth As String
strMonth = InputBox("Please Write Month- Case Sensitive", "MONTH")
If StrPtr(strMonth) = 0 Then
cancel = True
Exit Function
End If
getMonthNameFromUser = strMonth
End Function
Private Function isMonthNameValid(strMonth As String) As Boolean
'will check according to systems language
'e.g. in German: Januar - in English: January
Dim i As Long
For i = 1 To 12
If MonthName(i) = strMonth Then
isMonthNameValid = True
Exit For
End If
Next
End Function