dear all,
below part of my code inside a user form .
I am trying ,once the value is found to delete the entire row but no success (get an error on the line "hawb2.entirerow.delete").
can someone help ?
dim hawb2 As Range
Dim answer As Integer
test1 = TextBox2.Value
wk = ActiveWorkbook.Name
Set hawb2 = ActiveSheet.Range("b:b").Find(What:=test1, LookIn:=xlFormulas, LookAt:=xlWhole)
If Not hawb2 Is Nothing Then
answer = MsgBox("awb already exist in " & wk & " row " & hawb2.Row & vbNewLine & "would you like to delete it ?", vbYesNo + vbQuestion)
If answer = vbYes Then
hawb2.EntireRow.Delete
MsgBox "AWB DELETED"
Exit Sub
End If
If answer = vbNo Then
Exit Sub
End If
End If
Bookmarks