Difficult to say for sure without sight of a sample file for context, but perhaps this?
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
If x > 2 Then
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
Else
MsgBox "YOUR WARNING MESSAGE HERE", , ""
End If
End With
End If
txt_Count.Value = ThisWorkbook.Worksheets("EXTRAS").Range("A42")
txt_Name.SetFocus
End Sub
BSB
Bookmarks