Excel 2007 では問題なく動作するコードがありますが、Excel 2003 では動作しません。「コンパイル エラー」が発生し、この行が赤くなります。
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
あなたの提案は大いに役立ちます。ありがとう。私の側からの情報が必要な場合はお知らせください。
ここに私の完全なコードがあります:
'-------------------------------------
' Create Final Report
'-------------------------------------
Sub FinalReport()
Dim thisWb As Workbook
Set thisWb = ActiveWorkbook
Dim btn, rght As Long
Dim NewWbk As String
NewWbk = "Final_Report"
' Add a new workbook
Application.Workbooks.Add
Range("A1").Select
' Rename the workbook
ActiveWorkbook.SaveAs Filename:=thisWb.Path & Application.PathSeparator & "Final_Report" & ".xls"
Windows("Tool_01082013.xls").Activate
Sheets("Reports").Activate
' select the sheet and range to be copied
Range("B2:AO34").Select
' Copy the selected range...
Selection.Copy
Workbooks("Final_Report.xls").Sheets("Sheet1").Activate
' and Paste it into the new workbook
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Windows("Tool_01082013.xls").Activate
Sheets("Reports_Month").Activate
' select the sheet and range to be copied
Range("A1:DR34").Select
' Copy the selected range...
Selection.Copy
Workbooks("Final_Report.xls").Sheets("Sheet2").Activate
' and Paste it into the new workbook
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Workbooks("Final_Report.xls").Save
Workbooks("Final_Report.xls").Close
Windows("Tool_01082013.xls").Activate
With Sheets("Reports")
.Activate
.Range("A5").Select '-- move focus to the first item
End With
End Sub