Search for specific fields and Delete selected rows with VBA
У вашего броузера проблема в совместимости с HTML5
Search for specific fields and Delete selected rows with VBA. Create a userform to search for fields. Once the field is found then delete the row.
Private Sub CommandButton1_Click()
Dim account As String
Dim lastrow
Dim x As Long
lastrow = Worksheets("sheet1").Range("A1").CurrentRegion.Rows.Count
If TextBox1.Text = "" Then
MsgBox "Enter Account Number"
End If
account = Trim(TextBox1.Text)
x = 2
Do While Sheet1.Cells(x, 1) is not equal to ""
Set Rng = Sheet1.Columns("A:A").Find(What:=account, _
LookIn:=xlFormulas, LookAt:=xlWhole, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False)
If Rng Is Nothing Then
MsgBox "No order number found"
GoTo ende
Else
rownumber = Rng.Row
ActiveCell.EntireRow.Delete Shift:=xlUp
x = x + 1
End If
Loop
ende:
End Sub
Private Sub CommandButton2_Click()
TextBox1.Text = ""
End Sub