|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
买了excel 2010高效办公人力资源与行政管理,但我只有EXCEL2007,打开光盘的示例文件“基本考勤表.xlsm”出现调试错误,怎么办?
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Dim myDate As Byte, Should As Byte
If ActiveSheet.Index <> 1 And ActiveSheet.Index <> 2 Then '如果活动工作表不是[资料]表和[考勤统计表]
ActiveSheet.ScrollArea = "a1:s45"
ActiveSheet.Unprotect
For myDate = 6 To 36 '个人考核表激活时统计本月应出勤天数
If DatePart("w", ActiveSheet.Cells(myDate, 2).Value) <> 7 And DatePart("w", ActiveSheet.Cells(myDate, 2).Value) <> 1 Then
Should = Should + 1
End If
Next
ActiveSheet.Range("A40") = Should
ActiveSheet.Protect
End If
End Sub
|
|