I can't figure out how to add an error message to a button I have to clear rows of data.
The code works, but I only want the user to be able to delete row ranges from 8 onward.

If the user tries to delete any row range between 1:7 (1 through 7), then I want an error message to come up saying that "You can't delete any rows between 1 and 7."

Any help would be greatly appreciated.

Here's my code:

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
    
    'Can't delete rows 1-7 or error message pops up and exit sub
    If Config < 8 Then
    MsgBox ("Rows 1-7 cannot be cleared. Please enter row numbers from 8 and above."), vbInformation
    Exit Sub
    End If
    
    Ans = MsgBox(msg, Config, Title)
    If Ans = vbYes Then
        MySelection.EntireRow.ClearContents
        MsgBox ("Your Rows were successfully cleared."), vbInformation
    Else
        Range("A8").End(xlDown).Offset(1, 0).Select
    End If
    
'
End Sub


This is my feeble attempt to add the error message, but it doesn't work. It's hard for me to figure out because the user enters the data in row ranges such as: "8:22" .

 'Can't delete rows 1-7 or error message pops up and exit sub
    If Config < 8 Then
    MsgBox ("Rows 1-7 cannot be cleared. Please enter row numbers from 8 and above."), vbInformation
    Exit Sub
    End If