Can anybody see a fault with the following script as it just does not appear to work. The aim is to force users to populate cells before closing unless the workbook was opened as read only:

Private Sub Workbook_BeforeClose(Cancel As Boolean)

With Sheets("adhoc and change of status")

If Not Me.ReadOnly Then

If WorksheetFunction.CountA(.Range("C4091:C6000,D40916000,F4091:F6000,M4091:M6000,N4091:N6000,P4091:P6000,Q4091:Q6000")) <> 3 Then

MsgBox "You must complete C, D, F, M, N, P, Q as you did not open the spreadsheet read-only"

Cancel = True

End If

End If

End With

End Sub