[英]Excel VBA find string in column then delete all remaining row in worksheet
I am extremely new to VBA coding for excel and i really need to achieve this on 30 more workbooks containing each 250 worksheets...我对 Excel 的 VBA 编码非常陌生,我真的需要在包含每 250 个工作表的另外 30 个工作簿上实现这一点......
I need a VBA macro that can :我需要一个 VBA 宏,它可以:
Can anyone help ?任何人都可以帮忙吗?
Thanks in advance !提前致谢 !
Well,好,
Just in case someone stubble on this post through search and/or google :以防万一有人通过搜索和/或谷歌在这篇文章上胡茬:
I posted it on Reddit and a kind soul gave me the answer :我把它贴在 Reddit 上,一个善良的人给了我答案:
Sub DeleteRowsAfterFinding3()
Dim i As Long
Dim rangeFound As Range
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
Set rangeFound = ws.Range("A:A").Find("SOMETHING", Lookat:=xlWhole)
If Not rangeFound Is Nothing Then
For i = rangeFound.Row + 1 To ws.UsedRange.Rows.Count
ws.Rows(rangeFound.Row + 1).Delete
Next i
End If
Next ws
End Sub
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.