版权声明:一起学习,一起成长,欢迎关注 奔跑的犀牛先生 https://blog.csdn.net/xuemanqianshan/article/details/89220544
自动化错误的解决办法
http://club.excelhome.net/thread-1270827-1-1.html
https://zhidao.baidu.com/question/2201903842158113148.html
http://www.excelpx.com/thread-290493-1-1.html
http://club.excelhome.net/thread-1400268-1-1.html
出错的例子,这个原因是什么?
Rem 接下来想试验几个 从其他表读表名? 会报告数据源链接更新的问题
Sub t3()
Application.DisplayAlerts = False '消除警告
Dim wb As Workbook
Dim sh As Worksheet
Dim i As Integer
i = 1
Set wb = Workbooks.Open("C:\VBA\100.xls")
For Each sh In wb.Worksheets 'for each worksheet in wb 不行,变量不要用保留字 也不能 in wb
Do While wb.Sheets("create").Cells(i, 1) <> ""
If sh.Name = wb.Sheets("create").Cells(i, 1) Then
sh.Delete
End If
i = i + 1
Loop
Next
Application.DisplayAlerts = True '重开警告
End Sub