分兩段是因為不曉得如何讓 1 To 10 執行完成,才跳出訊息視窗,請求縮減內容謝謝
Sub Test()
For aq = 1 To 10
If Cells(aq, 1) > 1 Then
Cells(aq, 1).Interior.Color = RGB(255, 255, 0)
End If
Next
For aq = 1 To 10
If Cells(aq, 1).Interior.Color = RGB(255, 255, 0) Then
MsgBox "超過數量"
End
End If
Next
End Sub
Sub Test()
Dim u As Integer
u = 0
For aq = 1 To 10
If Cells(aq, 1) > 1 Then
Cells(aq, 1).Interior.Color = RGB(255, 255, 0)
u = 1
End If
Next
If u > 0 Then
MsgBox "超過數量"
End If
End Sub
For aq = 1 To 10
If Cells(aq, 1) > 1 Then
Cells(aq, 1).Interior.Color = RGB(255, 255, 0)
End If
Next
MsgBox "超過數量"