VBA :如何单元格里 的字符串里含有“Sign”这个字符,就删除这一行,怎么编?Sign. Q8 3134205 D6000

还有Sign_Q8_2983246_D6003,都很乱的字符啊,只要含有Sign就删除整行?怎么编

第1个回答  2011-05-14
Sub 查找并删除整行()
Dim c As Range, s$, iAdd$, n&
s = InputBox("请输入要查找的字符:", "查找并删除整行", "Sign")
' s="Sign"
Set c = Cells.Find(s, , xlValues, xlPart)
If c Is Nothing Then MsgBox "没有找到“" & s & "”字符串!", vbCritical: Exit Sub
iAdd = c.Address
Do
c.EntireRow.Delete
n = n + 1
Set c = Cells.Find(s, , xlValues, xlPart)
If c Is Nothing Then Exit Do
Loop Until c.Address = iAdd
MsgBox "共删除了 " & n & "行。", vbInformation
End Sub
第2个回答  2011-05-14
Sub Macro1()

Dim rng As Range
Dim what As String
what = "sign"
Do
Set rng = ActiveSheet.Cells.Find(what)
If rng Is Nothing Then
Exit Do
Else
rng.Activate
Rows(rng.Row).Delete
End If
Loop

End Sub
第3个回答  2011-05-14
凡是表格都可以再EXCEL完成,而且很方便。
尤其是有数据运算,建立图表等,EXCEL优势更加明显,可以省去你大量的计算时间,因为在表中能自动完成各种运算。
要学当然是学制表的方法,运算的公式运用,还有统计,图表的建立等等。
第4个回答  2011-05-14
Cells.Find(What:="sign").Activate
Selection.EntireRow.Delete

相关了解……

你可能感兴趣的内容

大家正在搜

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网