I have a spreadsheet, which contains the word variance in column A and and value in column D that is in line with the word "variance".
I have written code that will advise me where there is a value that is either greater or less that zero in column D in line with the word "variance", but cannot get it to work propertly. I have also attached sample data below. It would be appreciated if you could assist me
Sub Variance_Message()
Sheets("sheet1").Select
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 (r.Offset(, 3).Value< 0) + (r.Offset(, 3).Value > 0) 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")
End Sub
I have written code that will advise me where there is a value that is either greater or less that zero in column D in line with the word "variance", but cannot get it to work propertly. I have also attached sample data below. It would be appreciated if you could assist me
Sub Variance_Message()
Sheets("sheet1").Select
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 (r.Offset(, 3).Value< 0) + (r.Offset(, 3).Value > 0) 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")
End Sub