Ensure that no blanks are left in Date column

daithiboy

Board Regular
Joined
Jul 1, 2016
Messages
77
Hi Guys,

I have a couple of sheets that are accessed my one other person. I have dashboards with pivot tables that are all based around grouped dates. My colleague is in the habit of not filling the info out correctly and has been know to leave a date blank and refresh the workbook, hence removing all of my groupings which I then have to fix (dozens of pivot tables).

What I am wondering is, if I can force excel to only allow dates in certain columns and when a new row is added to the table that if the date field is not entered correctly then a hand comes out of the screen and serves up some excel justice across the face, or maybe just a dialog box, or I'd even be happy with "01/01/1900" in the cell. Anything to prevent my groupings from being lost.

I hope that is clear and any suggestions would be greatly appreciated.

Cheers,
Dave
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Try this (where the highlighted cells are named "Compulsory"):

VBA Code:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
    intCount = ThisWorkbook.Names("Compulsory").RefersToRange.Count
    If WorksheetFunction.CountA(Worksheets("Sheet1").Range("Compulsory")) < intCount Then
        MsgBox "Workbook will not close unless ALL dates have been filled in!", , "Missing info"
        Cancel = True
    End If
End Sub

ensure-that-no-blanks-are-left-in-date-column.1119419.jpg

ensure-that-no-blanks-are-left-in-date-column.1119419(2).jpg


Now if any row or empty cell is in the Compulsory area the Workbook cannot be saved.
 
Upvote 0

Forum statistics

Threads
1,214,591
Messages
6,120,427
Members
448,961
Latest member
nzskater

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top