I'm trying to setup a macro that will check three designated cells for zero values. There are two subs; one to designate cells to be used and another to give give message boxes depending on cell values. If any zero values are found, a message box will come up stating that one of the cells has not been given a value other than zero ("bill has not been entered"). If all three cells have a value other than zero, a different message box will come up stating that all cells are filled in (all bills have been entered). The problem I'm having is that the message box for "no gas bill has been entered" comes up regardless of whether the cell has a real value or zero.
Here's what I've got so far:
Sub SetBills()
Dim ElectricBill As Integer
Dim GasBill As Integer
Dim WaterBill As Integer
Set ElectricBill = Sheets("LGE Info").Cell(E27).Value
Set GasBill = Sheets("LGE Info").Cell(E32).Value
Set WaterBill = Sheets("Water Bill").Cell(D16).Value
End Sub
Sub Ready()
'
' Ready Macro
' Tells admin if bills are ready to be printed.
'
'
If GasBill = 0 Then
MsgBox "No, the gas bill has not been entered yet."
ElseIf ElectricBill = 0 Then
MsgBox "No, the electric bill has not been entered yet."
ElseIf WaterBill = 0 Then
MsgBox "No, the water bill has not been entered yet."
Else
MsgBox "Yes, bills are ready to be printed."
End If
End Sub
I'm at a loss as to why I'm not getting the right message box. Help!
Bookmarks