自动填充 MsgBox
Auto populating MsgBox
我想知道是否有人可以帮我把下面的变成一个消息框。基本上我希望它首先检查是否有任何以下范围的说 CHECK 如果他们这样做,将出现一个 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 Err As String
If UCase(Range("DaisyFreshRule").Value) = "CHECK" Then Err = Err & "Daisy Fresh Rule" & vbNewLine
If UCase(Range("MigrationRule").Value) = "CHECK" Then Err = Err & "Migration Rule" & vbNewLine
If UCase(Range("ServiceCreditRule").Value) = "CHECK" Then Err = Err & "Service Credit Rule" & vbNewLine
If Not Err = vbNullString Then MsgBox prompt:=Err, Buttons:=vbCritical
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
我想知道是否有人可以帮我把下面的变成一个消息框。基本上我希望它首先检查是否有任何以下范围的说 CHECK 如果他们这样做,将出现一个 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 Err As String
If UCase(Range("DaisyFreshRule").Value) = "CHECK" Then Err = Err & "Daisy Fresh Rule" & vbNewLine
If UCase(Range("MigrationRule").Value) = "CHECK" Then Err = Err & "Migration Rule" & vbNewLine
If UCase(Range("ServiceCreditRule").Value) = "CHECK" Then Err = Err & "Service Credit Rule" & vbNewLine
If Not Err = vbNullString Then MsgBox prompt:=Err, Buttons:=vbCritical
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