Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Dim i, l, r As Range, cnt cnt = 0 i = ThisWorkbook.Sheets(1).Range("A" & Rows.Count).End(xlUp).Row For l = 1 To i If ThisWorkbook.Sheets(1).Range("A" & 1).Value <> "" Then Set r = ThisWorkbook.Sheets(1).Range("B" & 1 & ":N" & 1) For Each Cell In r If IsEmpty(Cell) Then r.SpecialCells(xlCellTypeBlanks).Interior.ColorIndex = 6 cnt = cnt + 1 Cancel = True Exit For Else r.Interior.ColorIndex = xlNone End If Next End If Next l If cnt > 0 Then MsgBox ("There are required cells that needs to be filled.") End If End Sub
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE