操作工作簿
约 132 字小于 1 分钟
2024-07-07
操作工作簿
中断执行代码
按住Esc
键中断VBA程序
Sub 删除工作簿()
Dim biao As Worksheet
Application.DisplayAlerts = False
For Each biao In Sheets
If biao.Name <> "不要删" Then
biao.Delete
End If
Next
Application.DisplayAlerts = True
End Sub
Sub 改动文件内容()
'禁止屏幕刷新
Application.ScreenUpdating = False
'禁止弹窗警告
Application.DisplayAlerts = False
Workbooks.Open FileName:="test.xls "
ActiveWorkbook.Sheets(1).Range("b1") = "到此一游"
ActiveWorkbook.Save
ActiveWorkbook.Close
End Sub
Sub 创建新文件()
Workbooks.Add
ActiveWorkbook.Sheets(1).Range("a1") = "自动创建"
ActiveWorkbook.SaveAs FileName:="/data/test.xlsx"
ActiveWorkbook.Close
End Sub
更新日志
版权所有
版权归属:passwordgloo