Excel vba 模糊查找工作表名,并选中工作表
SubSelSht()'工作表查找DimShtAsStringDimstrAsStringOnErrorResumeNextSht=Application.InputBo...
Sub SelSht() '工作表查找
Dim Sht As String
Dim str As String
On Error Resume Next
Sht = Application.InputBox(prompt:="请输入要查找的值:", Title:="模糊查找", Type:=2)
Sheets(Sht).Select
str = Err.Description
If str <> "" Then
MsgBox "不存在或名称输入有误!"
End If
End Sub
上面这个要怎么改成模糊查找工作表名称? 展开
Dim Sht As String
Dim str As String
On Error Resume Next
Sht = Application.InputBox(prompt:="请输入要查找的值:", Title:="模糊查找", Type:=2)
Sheets(Sht).Select
str = Err.Description
If str <> "" Then
MsgBox "不存在或名称输入有误!"
End If
End Sub
上面这个要怎么改成模糊查找工作表名称? 展开
1个回答
展开全部
Sub SelSht() '工作表查找
Dim Sht As String
Dim str As String
Dim st as WorkSheet
Sht = Application.InputBox(prompt:="请输入要查找的值:", Title:="模糊查找", Type:=2)
str=""
for each st in sheets
if st.name like "*"& sht &"*" then
st.activate
st.select
str="ok"
exit for
end if
nest st
If str <> "ok" Then
MsgBox "不存在或名称输入有误!"
End If
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询