我正在“尝试”制作一个消息框,显示一列中有多少存在和缺席,以便用户可以单击“确定”并复制数据或按“取消”并结束代码。
问题是我似乎无法让 CountIf 部分在消息框中显示缺席和出席之前计算缺席和出席的数量。
我对编码很陌生,所以它可能真的一团糟,但任何帮助和我都将不胜感激:)
Sub SubmitAttendance()
Dim Response As String
Dim Question As String
Dim PresentNumber As String
Dim AbsentNumber As String
Function As Integer
PresentNumber = Countif(Range("E:E"), Present)
AbsentNumber = Countif(Range("E:E"), Absent)
End Function
Question = "PresentNumber Present and AbsentNumber Absent"
Response = MsgBox(Question, vbOKCancel, "Register Totals")
If Response = vbOK Then
Range("E:E").Select
Selection.Copy
Range("F:ZZ").Find("").Select
Selection.PasteSpecial
Else
Exit Function
End If
End Sub