I have the following macro to determine if there are variances in col C
I would like the code amended so that when message comes up "No variances "found" , macro to end, otherwise continue with macro
Date_Message
Date_Input
Your assistance in this regard is most appreciated
I would like the code amended so that when message comes up "No variances "found" , macro to end, otherwise continue with macro
Date_Message
Date_Input
Your assistance in this regard is most appreciated
Code:
Sub Variance_Message()
Dim ws As Worksheet, r As Range, msg As String, ff As String
For Each ws In Sheets
Set r = ws.Columns("b").Find("Variance")
If Not r Is Nothing Then
ff = r.Address
Do
If 5 < Abs(Val(CStr(r.Offset(0, 1).Value))) Then
msg = msg & ws.Name & r.Address(0, 0)
End If
Set r = ws.Columns("b").FindNext(r)
Loop Until ff = r.Address
End If
Next
MsgBox IIf(Len(msg) > 0, msg, "No Variances Found")
Date_Message
Date_Input
End Sub
Sub Date_Message()
Sheets("Macro").Select
MsgBox ("Remember to change the month and year")
Sheets(2).Select
End Sub
Sub Date_Input()
Sheets(2).Select
Range("a3").Select
Dim MyDate As String
ActiveCell.FormulaR1C1 = InputBox("Enter the current Month and year for eg Jan 2018")
Sheets(1).Select
End Sub