Excel查找指定工作表vba代码: Function ExistSh(Sh As String) As Boolean Dim Sht As Object On Error Resume Next Set Sht = Sheets(Sh) If Err.Number = 0 Then ExistSh = True Set Sht = NothingEnd Function Sub NotSht() Dim Sh As StringSh = InputBox("请输入工作表名称:")If Len(Sh) > 0 Then If Not ExistSh(Sh) Then MsgBox "对不起," & Sh & "工作表不存在!" Else MsgBox "工作表 " & Sh & " 存在,已选中!" Sheets(Sh).Select End IfEnd IfEnd Sub
点击加入群:Excel部落结识Excel大神学好Excel,效率成倍提高,薪水稳步增长,职位快速提升
每天一个源创技巧,如觉得有用,请点上面关注。更重要手机转发分享