Sub cha() Dim result As String, str1 As String Dim hang As String Dim hha As Integer hha = 0 Dim c As Range, rng As Range result = "航空" result = Application.InputBox(prompt:="请输入要查找的值:", Title:="模糊查找", Type:=2) If result = "False" Or result = "" Then Exit Sub Application.ScreenUpdating = False Application.DisplayAlerts = False 'Set rng = ActiveSheet.Range("c1").CurrentRegion str1 = "*" & result & "*" ' Set av = Worksheets("航班") Set rng = ActiveSheet.Range("a1:z65535").CurrentRegion For Each c In rng.Cells 'For Each c In av If c.Value Like str1 Then hha = hha + 1 c.Interior.ColorIndex = 0 '0恢复默认色 4绿色 c.EntireRow.Copy Sheets("汇总1").Cells(str(hha), 1) hang = c.Row End If Next Application.ScreenUpdating = True Application.DisplayAlerts = True End Sub
标签:复制到,Dim,VBA,rng,hha,Application,整行,result,Range From: https://www.cnblogs.com/xkdn/p/16899635.html