Stock reminder popup VBA

 Sub StockReminder()

    Dim lastRow As Long

    Dim i As Long

    Dim alertMsg As String


    lastRow = Cells(Rows.Count, "A").End(xlUp).Row


    For i = 2 To lastRow

        If Cells(i, 2).Value <= Cells(i, 3).Value Then

            alertMsg = alertMsg & Cells(i, 1).Value & " is LOW STOCK!" & vbNewLine

        End If

    Next i


    If alertMsg <> "" Then

        MsgBox alertMsg, vbCritical, "Stock Alert ⚠"

    End If

End Sub

Post a Comment

0 Comments