用VBA如何查找表,判断这张工作表是否存在,如果存在就删除,并且不显示删除提示。
答案:1 悬赏:50
解决时间 2021-12-27 07:04
- 提问者网友:锁深秋
- 2021-12-26 19:43
用VBA如何查找表,判断这张工作表是否存在,如果存在就删除,并且不显示删除提示。
最佳答案
- 二级知识专家网友:渡鹤影
- 2021-12-26 20:50
你说的是某个文件?
ipath = "c:\aaa.xls" '文件的详细地址
Application.DisplayAlerts = False
If Dir(ipath) = "" Then Kill ipath
Application.DisplayAlerts = True
还是一个文件里的某个sheet表?
shname = "aaaaaa" 'sheet表的名字
For Each sh In Sheets
If sh.Name = shname Then
Application.DisplayAlerts = False
sh.Delete
Application.DisplayAlerts = True
End If
Next
ipath = "c:\aaa.xls" '文件的详细地址
Application.DisplayAlerts = False
If Dir(ipath) = "" Then Kill ipath
Application.DisplayAlerts = True
还是一个文件里的某个sheet表?
shname = "aaaaaa" 'sheet表的名字
For Each sh In Sheets
If sh.Name = shname Then
Application.DisplayAlerts = False
sh.Delete
Application.DisplayAlerts = True
End If
Next
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯