Private Sub Worksheet_Calculate()
Dim Cell1 As Range, msg1 As String
Dim Cell2 As Range, msg2 As String
Dim Cell3 As Range, msg3 As String
Dim Cell4 As Range, msg4 As String
Dim Cell5 As Range, msg5 As String
Dim Cell6 As Range, msg6 As String
Dim Cell7 As Range, msg7 As String
Dim Cell8 As Range, msg8 As String
Dim Cell9 As Range, msg9 As String
Set Cell1 = Range("H6"): msg1 = "WARNING!!! Please Check the LSFO Meter Reading!"
Set Cell2 = Range("H7"): msg2 = "WARNING!!! Please Check the LSMGO Meter Reading!"
Set Cell3 = Range("E3"): msg3 = "WARNING!!! Please Check the M/T Counter Reading!"
Set Cell4 = Range("I9"): msg4 = "WARNING!!! Please Check the Gas Counter Reading!"
Set Cell5 = Range("B9"): msg5 = "WARNING!!! Please Check No 1 Nitrogen Counter!"
Set Cell6 = Range("B10"): msg6 = "WARNING!!! Please Check No 2 Nitrogen Counter!"
Set Cell7 = Range("E9"): msg7 = "WARNING!!! Please Check D/Alt Counters!"
Set Cell8 = Range("Z3"): msg8 = "High distilled water consumption is because ..."
Set Cell9 = Range("Z4"): msg9 = "High domestic water consumption is because ..."
With Range("H13:K14")
If Not IsEmpty(Range("C5")) And Range("J17") = "LSFO" Then
Select Case Cell1.Value
Case 0 To 200
.ClearContents
Case Else
.Value = msg1
MsgBox msg1, vbExclamation, Title:="LSFO Counter Error"
TalkFOCtr
End Select
End If
End With
With Range("H13:K14")
If Not IsEmpty(Range("C5")) And Range("J17") = "LSMGO" Then
Select Case Cell2.Value
Case 0 To 200
.ClearContents
Case Else
.Value = msg2
MsgBox msg2, vbExclamation, Title:="LSMGO Counter Error"
TalkFOCtr
End Select
End If
End With
'M/T counter
With Range("H13:K14")
If Not IsEmpty(Range("C4")) And Not Range("E3") = "N/A" Then
Select Case Cell3.Value
Case 0 To 82
.ClearContents
Case Else
.Value = msg3
MsgBox msg3, vbExclamation, Title:="M/T Counter Error"
Call TalkMTCtr
End Select
End If
End With
'Gas Counter
With Range("H13:K14")
If Not IsEmpty(Range("C6")) Then
Select Case Cell4.Value
Case 0 To 400
.ClearContents
Case Else
.Value = msg4
MsgBox msg4, vbExclamation, Title:="Gas Counter Error"
Call TalkGasCtr
End Select
End If
End With
'No 1 N2 Hours
With Range("H13:K14")
If Not IsEmpty(Range("C7")) Then
Select Case Cell5.Value
Case 0 To 24
.ClearContents
Case Else
.Value = msg5
MsgBox msg5, vbExclamation, Title:="No 1 N2 Plant Counter Error"
TalkN2Ctr1
End Select
End If
End With
'No 2 N2 Hours
With Range("H13:K14")
If Not IsEmpty(Range("C8")) Then
Select Case Cell6.Value
Case 0 To 24
.ClearContents
Case Else
.Value = msg6
MsgBox msg6, vbExclamation, Title:="No 2 N2 Plant Counter Error"
TalkN2Ctr2
End Select
End If
End With
'D/Alt Counters
With Range("H13:K14")
If Not IsEmpty(Range("C11")) And Not IsEmpty(Range("C12")) Then
Select Case Cell7.Value
Case 0 To 20
.ClearContents
Case Else
.Value = msg7
MsgBox msg7, vbExclamation, Title:="D/Alt Counter Error"
Call TalkDAltCtr
End Select
End If
End With
'Distilled Water Consumption
With Range("H13:K14")
If Not IsEmpty(Range("I3")) Then
Select Case Cell8.Value
Case 0 To 20
.ClearContents
Case Else
.Value = msg8
MsgBox "WARNING!!! High Distilled Water Consumption! - Above 20tons. Complete the Sentance in the Below Message Box Giving a Valid Reason", vbExclamation, Title:="High Distilled Water Consumption"
Call TalkDistilled
End Select
End If
End With
'Domestic Water Consumption
With Range("H13:K14")
If Not IsEmpty(Range("I4")) Then
Select Case Cell9.Value
Case 0 To 20
.ClearContents
Case Else
.Value = msg9
MsgBox "WARNING!!! High Domestic Water Consumption! - Above 20tons. Complete the Sentance in the Below Message Box Giving a Valid Reason", vbExclamation, Title:="High Distilled Water Consumption"
Call TalkDomestic
End Select
End If
End With
End Sub