Vba 如何使用find函数删除整行?

Vba 如何使用find函数删除整行?,vba,excel,Vba,Excel,我有一份数据表,里面有一套公寓楼的数据。我制作了用户表单来添加、编辑和删除租户。然而,我删除它们的方式在我的数据中留下了一个空白,并且不得不手动删除所有行以保持工作表的整洁变得非常烦人 Sheet1.Select Dim FndRng As Range Set FndRng = Sheet1.Columns("C:C").Find(What:=cboName.Value, LookIn:=xlFormulas, LookAt:=xlPart, _ SearchO

我有一份数据表,里面有一套公寓楼的数据。我制作了用户表单来添加、编辑和删除租户。然而,我删除它们的方式在我的数据中留下了一个空白,并且不得不手动删除所有行以保持工作表的整洁变得非常烦人

Sheet1.Select

Dim FndRng As Range

Set FndRng = Sheet1.Columns("C:C").Find(What:=cboName.Value,    LookIn:=xlFormulas, LookAt:=xlPart, _
            SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False)

If Not FndRng Is Nothing Then 'successful find
FndRng.Offset(0, -1).Value = ""
FndRng.Value = ""
FndRng.Offset(0, 1).Value = ""
FndRng.Offset(0, 2).Value = ""
FndRng.Offset(0, 3).Value = ""
FndRng.Offset(0, 4).Value = ""
FndRng.Offset(0, 5).Value = ""
FndRng.Offset(0, 6).Value = ""
FndRng.Offset(0, 7).Value = ""
FndRng.Offset(0, 8).Value = ""
FndRng.Offset(0, 9).Value = ""
FndRng.Offset(0, 10).Value = ""
FndRng.Offset(0, 11).Value = ""

cboName.Value = ""
txtCode.Value = ""
cboGrade.Value = ""
txtPhone.Value = ""
txtDormitory.Value = ""
cboPhase.Value = ""
cboCourse.Value = ""
cboStatus.Value = ""
txtGrad.Value = ""
txtCsd.Value = ""
txtSsn.Value = ""
txtComments.Value = ""
cboSex.Value = ""

Else ' unable to find the value in "Name"
MsgBox "Name not found in Datasheet, Do not change the name while editing the profile.", , "Name not Found"
End If

End Sub
但正如你所见,这只会在数据上留下一个很大的缺口。 我想做一些像

fndRng.row.delete
或者说,如果你能遵循我的思维过程

提前感谢您的帮助

而不是

fndRng.row.delete
使用


可能是我看过你建议的文章的副本,但由Mrig提供,fndrn.EntireRow.Delete是我要找的。我知道我想要什么我只是很久没用VBA了我有点迷糊了。非常感谢你!
FndRng.EntireRow.Delete