gpt4 book ai didi

vba - 自动填充 MsgBox

转载 作者:行者123 更新时间:2023-12-04 21:09:09 28 4
gpt4 key购买 nike

我想知道是否有人可以帮助我将下面的内容变成一个消息框。基本上我希望它首先检查以下范围是否有 查看 如果他们这样做,则会出现一个 msgbox,解释违反了哪条规则。我曾尝试创建变量,但不确定如何在 msgbox 中将其付诸实践。

Sub ErrorMsgBox()

Dim Error1 As String
If Range("DaisyFreshRule").Value = "CHECK" Then
Error1 = "Daisy Fresh Rule"
Else
End If

Dim Error2 As String
If Range("MigrationRule").Value = "CHECK" Then
Error2 = "Migration Rule"
Else
End If

Dim Error3 As String
If Range("ServiceCreditRule").Value = "CHECK" Then
Error3 = "Service Credit Rule"
Else
End If

End Sub

最佳答案

Sub ErrorMsgBox()

Dim Error As String: Error=""

If Range("DaisyFreshRule").Value = "CHECK" Then
Error = vbNewLine & "Daisy Fresh Rule"
End If

If Range("MigrationRule").Value = "CHECK" Then
Error = Error & vbNewLine & "Migration Rule"
End If

If Range("ServiceCreditRule").Value = "CHECK" Then
Error = Error & vbNewLine & "Service Credit Rule"
End If

If Error <> "" Then
MsgBox "The following checks have been detected:" & Error
End If

End Sub

关于vba - 自动填充 MsgBox,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44204578/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com