The_Gigster
New Member
- Joined
- Nov 4, 2016
- Messages
- 5
Hello all
I have a workbook that needs to go to various external stakeholders. I need them to fill a number of fields. I have named the range of these fields "Mandatory".
However, there are occasions where the external stakeholder may not be ready to fill the form in after viewing it and I need internal stakeholders to be able to view and use the workbook without the need for them to fill these fields and be able to close the file.
Does anyone have any any ideas of what I can do to get around this loop?
Many thanks
The Gigster
I have a workbook that needs to go to various external stakeholders. I need them to fill a number of fields. I have named the range of these fields "Mandatory".
However, there are occasions where the external stakeholder may not be ready to fill the form in after viewing it and I need internal stakeholders to be able to view and use the workbook without the need for them to fill these fields and be able to close the file.
Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim rng As Range
Dim c As Variant
Dim rngCount As Integer
Dim CellCount As Integer
Set rng = Range("Mandatory")
rngCount = rng.Count
CellCount = 0
For Each c In rng
If Len(c) > 0 Then
CellCount = CellCount + 1
End If
Next c
If CellCount <> rngCount Then
MsgBox "Please fill Mandatory Fields", vbExclamation, "Required Entry"
Cancel = True
End If
Does anyone have any any ideas of what I can do to get around this loop?
Many thanks
The Gigster