以下是我正在使用的代码,但它会在range.value
行引发1004错误。但是,它成功复制了没有公式的工作表(只是值)。只是运行它会不断抛出错误1004。
Sub test1()
Dim wbNew As Workbook
Dim wks As Worksheet
Set wbNew = Workbooks.Add(xlWBATWorksheet)
ThisWorkbook.Worksheets.Copy After:=wbNew.Worksheets(1)
Application.DisplayAlerts = False
wbNew.Worksheets(1).Delete
Application.DisplayAlerts = True
Application.Calculation = xlCalculationManual
For Each wks In wbNew.Worksheets
wks.UsedRange.Value = wks.UsedRange.Value
Next wks
Application.Dialogs(xlDialogSaveAs).Show
End Sub
答案 0 :(得分:0)
wks.usedrange.value = wks.usedrange.value的目的是什么? 此问题与VBA是否允许该命令无关。
答案 1 :(得分:0)
无法理解你为什么要这样做:
For Each wks In wbNew.Worksheets
wks.UsedRange.Value = wks.UsedRange.Value
Next wks
就像说x = x