I have a macro to display a message box
I need to show each message in a seperate cell , but all the message displays on one cell
it would to show each message on a separate cell on sheet 'Macro"
It would be appreciated if someone could amend my code
I need to show each message in a seperate cell , but all the message displays on one cell
it would to show each message on a separate cell on sheet 'Macro"
It would be appreciated if someone could amend my code
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
If Len(msg) = 0 Then
MsgBox "No Variances Found"
Exit Sub
Else
MsgBox msg
Worksheets("Macro").Range("a1:A15").Value = msg
End If
End Sub