如果用户改变主意,仅尝试允许用户关闭/取消该应用程序。
我尝试了cancelButton,而不是pymsgbox.prompt,pymsgbox.Confirm,无济于事。
Sub Mark_Duplicates()
Dim Cell As Variant
Dim Source As Range
Dim Source2 As Range
Dim rownumber As Variant
Set Source = Range("B1:B1000")
Set Source2 = Worksheets("Chain").Range("A1:A1000")
For Each Cell In Source
If Application.WorksheetFunction.CountIf(Source2, Cell) > 1 Then
rownumber = ActiveCell.Row
Cell.Interior.Color = RGB(255, 255, 0)
Range("C" & rownumber).Interior.Color = RGB(255, 255, 0)
Range("D" & rownumber).Interior.Color = RGB(255, 255, 0)
Range("F" & rownumber).Interior.Color = RGB(255, 255, 0)
End If
Next
End Sub
我陷入了困境。当我选择取消按钮时,该应用程序不会关闭。当我单击红色的X时,它也不会关闭。