|
各位大侠帮忙看看,我编写到下面程序调试是老是出错,提示类型不匹配,请各位大侠看看什么原因。
多谢。
程序如下:
Sub ttwimaxdetail()
Dim arr, thedate As Date, thefirstweekday As Date, theweeknumber As Integer, totalweeknum As Integer
Dim theweekday As Integer, i As Integer, j As Integer, x As Integer, therowquantity As Integer
arr = Sheets("detail table").[a1].Resize(1000, 200)
'Sheets("progress table").Range("A1").Resize(UBound(arr, 1), 1) = Application.WorksheetFunction.Index(arr, 0, 1)
thedate = Sheets("progress summary").Cells(1, 3)
theweekday = Weekday(thedate)
thefirstweekday = Sheets("progress summary").Range("c1") - theweekday + 1
For i = 6 To 12
Sheets("progress summary").Range("B" & i) = thefirstweekday + i - 6
Next i
theweeknumber = WorksheetFunction.WeekNum(thedate)
Sheets("progress summary").Range("c2") = theweeknumber
Sheets("progress summary").Range("B16") = Year(thedate)
Sheets("progress summary").Range("B46") = Year(thedate)
totalweeknum = WorksheetFunction.WeekNum(DateSerial(Year(thedate) + 1, 1, 0))
therowquantity = Sheets("progress table").Range("A1").End(xlDown).Row
For i = 1 To 12
Cells(16, i + 3) = Format(i * 29, "mmm")
Next i
For i = 1 To totalweeknum
Cells(46, i + 3) = i
Next i
For i = 2 To therowquantity
If arr(i, 66) = "OK" And arr(i, 70) < thefirstweekday Then
x = x + 1
End If
Next i
Sheets("progress summary").Range("K5") = x
x = 0
Stop
End Sub |
|