コンパイル中に実行時エラー 13 が発生します。これは、
エラー、y = Application.counta(("A:A") <> "" - 3)。y をバリアントとして宣言しようとしました/ () も役に立ちませんでした。誰かが私が間違いを犯している場所を指摘してもらえますか?それは非常に役に立ちます.
Option Explicit
Sub Test()
' z= no of rows(temp calc sheet emp id)
' x= no of columns(dashboard calender)
' y= no of rows(dashboard emp id)
Dim i, j, k, d, x, y, z As Long
Dim Empid As Long
Dim currentdate, startdate, enddate As Date
'Dim countA As Long
startdate = Worksheets("Temp calc").Range("C2")
enddate = Worksheets("Temp calc").Range("D2")
x = (Range("n2") - Range("n1"))
y = Application.counta(("A:A") <> "" - 3)
z = Worksheets("Temp Calc").counta(("A:A") - 1)
For i = 1 To y 'To loop through the emp_id in dashboard.
For j = 1 To x Step 1 'To loop through the calender in dashboard daywise.
For k = 1 To z 'To loop through the emp_id i temp calc sheet.
d = 0
Empid = Cells(4, i)
currentdate = Cells(3, 17 + j)
If (Cells(k, 1)) = Empid Then
If (currentdate > startdate) & (currentdate < enddate) Then 'To check whether the first column date falls within the project start and end date
d = d + 1
startdate = startdate + 1
enddate = enddate + 1
Cells(i + 3, j + 16) = d
End If
End If
Next
Next
Next
End Sub