I have a UserForm with a ListBox. I also have a Command Button to delete rows from the ListBox. (Code Below), due to the way I've constructed the ListBox it MUST contain at least one row. I'd like to include code in the DELETE command that return a Message stopping the delete if there is only one row in the Listbox .. any suggestions.
'DELETE BUTTON CODE UPDATED

Private Sub cmd_Delete_Click()

               Dim x As Long
               Dim Y As Long
If MsgBox("ARE YOU SURE YOU WISH TO DELETE STRUCTURE ?", vbYesNo + vbQuestion, "DELETE") = vbYes Then
        With ThisWorkbook.Worksheets("ANALYSISDB")
            x = .Range("A" & .Rows.Count).End(xlUp).row

            For Y = x To 2 Step -1
             If .Cells(Y, 1).Value = txt_Search.Text Then
                        ThisWorkbook.Worksheets("ANALYSISDB").Rows(Y).Delete
              End If
            Next Y
        End With

End If

txt_Count.Value = ThisWorkbook.Worksheets("EXTRAS").Range("A42")
txt_Name.SetFocus

End Sub