Loss1003
04-27-2015, 12:38 PM
Howdy - How can i edit the below code to display the offset value of the cell within myRefs array.
When the code runs and finds a value of "" Or "0" in one of the cells included in the array. I'd like to display the offset cell value inside a msg box.
For instance if the value in cell B4 or B13 = "" or "0" then I'd like the value in Cell A4 and A13 to display in the message box.
Sub check1()
Sheet12.Activate
Dim MyRefs As Variant
Dim Ref As Variant
Dim Msg As String
MyRefs = Array("B4", "B6", "B8", "B10", "B12", "B13", "B14", "F13", "B15")
For Each Ref In MyRefs
With Sheet12
If .Range(Ref).Text = "" Or "0" Then
'Msg = Msg & Ref & vbNewLine
Msg = Msg & Ref & vbNewLine
End If
End With
Next Ref
If Msg <> "" Then
MsgBox "The folloiwng cells are empty. Please exit and enter the missing information!" & vbNewLine & vbNewLine & Msg, vbInformation
Else
End If
End Sub
When the code runs and finds a value of "" Or "0" in one of the cells included in the array. I'd like to display the offset cell value inside a msg box.
For instance if the value in cell B4 or B13 = "" or "0" then I'd like the value in Cell A4 and A13 to display in the message box.
Sub check1()
Sheet12.Activate
Dim MyRefs As Variant
Dim Ref As Variant
Dim Msg As String
MyRefs = Array("B4", "B6", "B8", "B10", "B12", "B13", "B14", "F13", "B15")
For Each Ref In MyRefs
With Sheet12
If .Range(Ref).Text = "" Or "0" Then
'Msg = Msg & Ref & vbNewLine
Msg = Msg & Ref & vbNewLine
End If
End With
Next Ref
If Msg <> "" Then
MsgBox "The folloiwng cells are empty. Please exit and enter the missing information!" & vbNewLine & vbNewLine & Msg, vbInformation
Else
End If
End Sub