Hello,
I have a macro that works fine except for one thing.
The user is prompted to enter a row range to clear.
The entered range must be separated by a colon. (eg. 9:14)
This would clear rows 9 to 14.
However, if the user enters just a single number (9) or a range not separated by a colon (9,14)
then I want an error message to come up saying
"You must enter a row range separated by a colon (example: 9:14)"
Then they'll click OK and the sub will end.
Any help will be really appreciated. I'm still learning macros 
Sub Clear_Row_Range()
'
' Clear_Row_Range Macro
'
Dim MySelection As Range
Dim msg As String, Title As String
Dim Config As Integer, Ans As Integer
msg = "Are you sure you want to clear this Row Range?"
On Error Resume Next
Title = "Confirm Row Deletion"
Config = vbYesNo + vbExclamation
Set MySelection = Application.InputBox(Prompt:="Enter the Row Range you would like to clear, separated with a colon (ex: 8:22)", Title:="Clear Row Range", Type:=8)
MySelection.Select
MyErr = Err
On Error GoTo 0
If MyErr <> 0 Then
MsgBox "You Pressed Cancel. No Rows Were Cleared."
Exit Sub
End If
'Rows 1-7 can't be entered to be deleted or this message comes up and sub exits.
If MySelection.Cells(1).row < 8 Then
MsgBox "Rows 1-7 cannot be cleared. Please enter row numbers of 8 and greater."
'Deselect row range.
Range("A8").Select
Exit Sub
End If
Ans = MsgBox(msg, Config, Title)
If Ans = vbYes Then
MySelection.EntireRow.ClearContents
MsgBox ("Your Rows were successfully cleared."), vbInformation
Else
'Deselect row range.
Range("A8").Select
End If
'
End Sub
Bookmarks