如何利用Excel中的宏编写程序完成下面的问题?

如题所述

第一题代码:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
  For i = 2 To 6
     If Not (IsNumeric(Sheet1.Cells(3, i)) And Sheet1.Cells(3, i) >= 0 And Sheet1.Cells(3, i) <= 100) Then
       MsgBox "成绩数字不对!"
       cancel = true
       Exit For
      End If
    Next
End Sub

第二题代码:

Sub AA()
Dim ran As Range
  For Each ran In Sheet1.UsedRange
      If ran > 0 And ran < 60 Then
       ran.Font.ColorIndex = 3
       ran.Interior.ColorIndex = 6
       End If
    Next
End Sub

温馨提示:答案为网友推荐,仅供参考
相似回答