There are two macros in the workbook:
Option Explicit
Private Sub Worksheet_Activate()
Range("h2").Value = "NO"
If Sheets("hardware list").Range("D2").Value = 0 Then
MsgBox "No 211 O-Rings available"
Range("E2").Select
End If
End Sub
The above changes the dropdown selection to NO when ever the worksheet is activated. It checks the hardware list sheet to see if the count is zero. If it is, then it moves the cursor to the adjacent cell so that the dropdown cannot be selected and gives a zero count message.
The code below is triggered whenever there is a change in check list sheet. If the change was triggered by a change in the dropdown cell H2. If it's YES, and the hardware list sheet is more than zero and subtracts two from that value.
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address(0, 0) = "H2" And Target.Value = "YES" Then
If Sheets("hardware list").Range("D2").Value > 0 Then
Sheets("hardware list").Range("D2").Value = Sheets("hardware list").Range("D2").Value - 2
End If
End If
End Sub
You can view the code by right clicking on the check list tab and selecting View Code.
Bookmarks