Hi,
I have written an excel macro, see below... it works fine for one single cell, but I need it to work down a column range of say 80 to 100 cells and can"t figure out how to make it go down the column. I have tried a loop, but all I was able to do was to compare M7 with the rest of the cells. What I want is to have this macro in each cell down the column M so when that particular item inventory reaches a certain value it brings up the msg box.
Any suggestions? THANKS!!!
Public Sub myMacro()
If Range("M7").Value <= Range("N7").Value And Range("M7").Value > 0 Then
MsgBox "INVENTORY HAS REACHED ORDERING POINT of " & Range("N7").Value & " You ONLY have" & " ( " & Range("M7").Value & " ) " & "Units left.", vbCritical, "WARNING!"
ElseIf Range("M7").Value = 0 Then
MsgBox "YOU ARE OUT OF INVENTORY!!" & " " & "YOU HAVE" & " ( " & Range("M7").Value & " ) " & " - NO UNITS LEFT!", vbCritical, "ALERT!!"
Else
If Range("M7").Value < 0 Then
MsgBox "YOU HAVE NEGATIVE INVENTORY!!!" & " " & "You are NEGATIVE BY" & " " & " (- " & 0 - Range("M7").Value & " ) " & "Units", vbCritical, "ALERT!!!"
End If
End If
End Sub
I have written an excel macro, see below... it works fine for one single cell, but I need it to work down a column range of say 80 to 100 cells and can"t figure out how to make it go down the column. I have tried a loop, but all I was able to do was to compare M7 with the rest of the cells. What I want is to have this macro in each cell down the column M so when that particular item inventory reaches a certain value it brings up the msg box.
Any suggestions? THANKS!!!
Public Sub myMacro()
If Range("M7").Value <= Range("N7").Value And Range("M7").Value > 0 Then
MsgBox "INVENTORY HAS REACHED ORDERING POINT of " & Range("N7").Value & " You ONLY have" & " ( " & Range("M7").Value & " ) " & "Units left.", vbCritical, "WARNING!"
ElseIf Range("M7").Value = 0 Then
MsgBox "YOU ARE OUT OF INVENTORY!!" & " " & "YOU HAVE" & " ( " & Range("M7").Value & " ) " & " - NO UNITS LEFT!", vbCritical, "ALERT!!"
Else
If Range("M7").Value < 0 Then
MsgBox "YOU HAVE NEGATIVE INVENTORY!!!" & " " & "You are NEGATIVE BY" & " " & " (- " & 0 - Range("M7").Value & " ) " & "Units", vbCritical, "ALERT!!!"
End If
End If
End Sub