Mandatory Cell completion for multiple worksheets in a workbook

Joined
Jan 14, 2014
Messages
1
Reaction score
0
Hi Team,

I'm currently in the process of compiling a form with multiple worksheets.

I have placed in a manadatory cell input code in VBA however, have since placed in two new worksheets that also require Mandatory cell completion.

My current code is as follows:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Flag = False
Set CloseRng = ActiveSheet.Range("C14, C16, C18, E23, C25, D25, E25, B29, B31, B33, E33, C35, E37, G39, G43, G49, G54, G59, G64, B66, C66, D66")
For Each c In CloseRng
If IsEmpty(c) Then
c.Interior.ColorIndex = 22
Flag = True
Else
c.Interior.ColorIndex = -4142
End If
Next c
If Flag = True Then
MsgBox "One or more required cells are blank"
Cancel = True
End If
End Sub

As disclosed, the code has been placed into the ThisWorkBook selection in VBA.

Please advise if I am able to apply a mandatory field input code to several spreadsheets in the same workbook.

To date, I have been unable to manipulate the code in order for it to provide what I am requiring.

Thanking you in advance for your assistance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top