我是excel宏的初学者,我正在尝试执行以下操作:
。
Sub CalculateSessiontime()
Dim userid As String
Dim visitid As Integer
Dim endtime As Integer
Dim RowNumber As Integer
Dim j As Integer
RowNumber = ActiveCell.Row
If Cells(RowNumber, 11).Value = "Yes" Then
userid = Cells(RowNumber, 1).Value
visitid = Cells(RowNumber, 8).Value
For j = RowNumber To 57627
If Cells(j, 1).Value <> userid Then
If Cells(j, 8).Value <> visitid Then
endtime = Cells(j - 1, 4).Value
ActiveCell.Value = endtime
End If
Else:
endtime = Cells(j - 1, 4).Value
ActiveCell.Value = endtime
End If
Next j
Else: End If
End Sub
我没有得到任何关于运行此代码的输出。请指出我正确的方向。