为什么我得到Error1004:无法设置Range类的NumberFormat属性?
Sub ReadFile(fileName As String)
Dim projectWb As Workbook
Dim lastRow As Long
Dim lastRowOutput As Long
Dim row As Long
Application.ScreenUpdating = False
Set projectWb = Workbooks.Open(Range("folderPath") & fileName, False)
lastRow = projectWb.Sheets("Beställningar").Cells.Find("*", [A1], xlValues, , xlByRows, xlPrevious).row
For row = 64 To lastRow
lastRowOutput = ThisWorkbook.Sheets("Output").Cells.Find("*", [A1], xlValues, , xlByRows, xlPrevious).row
'The folloing line works
ThisWorkbook.Sheets("Output").Range("F" & lastRowOutput + 1 & ":" & "M" & lastRowOutput + 1).Value = projectWb.Sheets("Beställningar").Range("B" & row & ":" & "I" & row).Value 'Beställning
'The following line generates Error1004: unable to set the NumberFormat property of the Range class?
ThisWorkbook.Sheets("Output").Range("F" & lastRowOutput + 1 & ":" & "M" & lastRowOutput + 1).NumberFormat = projectWb.Sheets("Beställningar").Range("B" & row & ":" & "I" & row).NumberFormat 'Beställning
Next row
'close without saving
Application.DisplayAlerts = False
projectWb.Close (False)
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub