|
为什么一个简单的复制老是弹出运行错误424,求老师指点,代码如下:
Sub cop()
Dim mypath As String, wk As String, wk1 As String, wk2 As String, i%, j%, k%
Dim wb1, wb2, arr1, arr2
Dim d As Date, d1 As Date
d = Date
d1 = DateSerial(Year(Now), Month(Date - 7), 1)
wk = Application.WorksheetFunction.WeekNum(d) - 1
wk1 = Application.WorksheetFunction.WeekNum(d1)
wk2 = wk - 1
Set wb2 = ActiveWorkbook
ActiveSheet.Cells(3, 5) = d - Weekday(d, 2) - 6
ActiveSheet.Range("g93") = Month(Date - 7) & "月"
ActiveSheet.Range("h93") = wk2
mypath = "D:\Daily\HPV\cost report\W" & wk2 & "\eHR系统端数据计算_week" & wk2
Set wb1 = Workbooks.Open(mypath)
wb1.Sheets("week" & wk2 & "HPV&单台成本 (新)--eHR").Range("L31:L35").Value.Copy wb2.Sheets("week" & wk & "HPV&单台成本 (新)--eHR").Range("H94:H98")
End Sub
|
|