发布网友
共2个回答
热心网友
'如果结果放在 "汇总表"的A列
sub test()
for each sh in sheets
rw = 1 '从A1开始显示
if sh.name<>"汇总表" then
if f1(sh) then
sheets("汇总表").range("A" & rw) = sh.name
rw = rw +1
end if
end if
next
end sub
function f1(sh as worksheet) as boolean
on error goto l_end
a = sh.range("1:65536").find("中国人",lookin:=xlvalues,lookat:=xlpart)
f1=true
exit function
l_end:
f1 = false
end function
'执行 test 就可以了
热心网友
Sub 查找()
Dim i As Integer
Dim k As Integer
Dim x
Dim m As String
Dim s As Worksheet
Dim 汇总 As Worksheet
Set 汇总 = ThisWorkbook.Worksheets("汇总表")
k = 1
For i = 1 To ThisWorkbook.Sheets.Count
Set s = ThisWorkbook.Sheets(i)
If s.Name = "汇总表" Then
Else
For Each x In s.UsedRange
If x Like "*中国人*" Then
汇总.Cells(k, 1) = s.Name
k = k + 1
Exit For
End If
Next
End If
Next
MsgBox "查找完成"
End Sub