Sam,
Thanks, that almost works.
I have the following code set up for each sheet in my workbook. It is called from a reset button for the given sheets. After testing your code, it worked fine, until I used this button, which then caused a message for each cell in the range that was checked.
Function GeneralUseItemsClear()
'Resets the General Use Items Page to the original unused state.
Application.ScreenUpdating = False
'Reset the Yes/No field to No on the General Use Items Sheet and clear the Quantity Needed Column
With ActiveWorkbook.Worksheets("General Use Items")
.Range("A2:A39").Value = strNo
.Range("D2:D39").ClearContents
End With
Application.ScreenUpdating = True
Application.GoTo Sheets("General Use Items").Range("A1"), True
End Function
Luckily I tested it on a page with only 38 items. Other pages items number in the hundreds. And that same Function is called for each page in the entire workbook when the Reset Workbook button is used. Had I applied this to all the pages, then that numbers in the thousands.
Anyway, any suggestions on how to fix it?
I am using this code to make sure that on all the pages that need it the "Yes" and "No" fields are correct. Maybe this can be modified to cover both the numeric fields (column D on every page in the array) and the Yes/No fields. Or something similar to do the number thing.
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
'Allows the Yes/No fields to accept partial entries and lower case.
'Declare the variables
Dim lngRow As Long
Dim RngToCheck As Range
'Set the range to check for change.
Set RngToCheck = Intersect(Sh.Columns(1), Target)
'No need to do anything if nothing in Column A is changed
If Not RngToCheck Is Nothing Then
'Determine the sheets to check
For Each sht In Array(Sheet4, Sheet5, Sheet6, Sheet7, Sheet8, Sheet9, Sheet3, Sheet12, Sheet10, Sheet12, Sheet13, Sheet17, Sheet18)
If sht Is Sh Then
Application.ScreenUpdating = False
Application.EnableEvents = False
'Determine how many rows there are
lngRow = Application.Max(2, Sh.Range("A" & Sh.Rows.Count).End(xlUp).Row) 'if sheet only has headers then the last row number may have been less than 3.
'Set the acceptance to include lower case and single letters.
For Each cll In Intersect(Target, Sh.Range("A2:A" & lngRow)).Cells
Select Case cll.Value
Case "y", "Y", "yes": cll.Value = strYes
Case "n", "N", "no": cll.Value = strNo
End Select
Next cll
Application.ScreenUpdating = True
Exit For 'no need to check the rest if one sheet has been found.
End If
Next sht
End If
Application.EnableEvents = True
End Sub