Sub Command()
On Error Resume Next
Application.DisplayAlerts = False
Dim wb As Workbook
Dim lj, dirname
Application.ScreenUpdating = False
With Application.FileDialog(msoFileDialogFolderPicker)
.InitialFileName = "C:\Users\" & Environ("username") & "\Desktop\"
If .Show = True Then Path = .SelectedItems(1) & "\"
End With
If Path = "" Then Exit Sub
lj = Path
i = 2
dirname = Dir(lj & "\*.xl*")
Do While dirname <> ""
Application.DisplayAlerts = False
Sheets("sheet1").Range("a" & i).Value = dirname & "已清除公式"
On Error Resume Next
Set wb = Workbooks.Open(lj & dirname)
With wb.Sheets("料单1")
.UsedRange.Value = .UsedRange.Value
End With
Application.DisplayAlerts = False
wb.Save
wb.Close False '关闭源文件,不保存
dirname = Dir
i = i + 1
Loop
Application.DisplayAlerts = True
Sheets("sheet1").Range("a1").Value = Path
Application.ScreenUpdating = True
MsgBox "ok"
End Sub
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有