#1
|
|||
|
|||
SOLVED: How to check all cells before saving Workbook
There on Sheet1 are not filled three cells, B9, B20 and G13
I need a VBA macro that when closing the workbook (in event Before_Save or Before_Close) will check whether all cells filled and alert users Is possibility of this? Last edited by beginner; 04-25-2013 at 01:18 AM. Reason: SOLVED |
#2
|
||||
|
||||
You can do that with code in the workbook's ThisWorkbook module, like:
Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean) With Sheets("Sheet1") If .Range("B9").Value = "" Then Cancel = True If .Range("B20").Value = "" Then Cancel = True If .Range("G13").Value = "" Then Cancel = True End With If Cancel = True Then MsgBox "Please complete all required cells" End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
SOLVED: How to check all cells before saving Workbook
@macropod thank you for answering and macro
Macro works correctly Last edited by beginner; 04-25-2013 at 01:17 AM. Reason: SOLVED |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
cannot check/uncheck check box but added check box | learn2office | Word | 1 | 11-27-2012 02:02 AM |
#REF! error when opening a workbook that contain a refference to another workbook | tanababa | Excel | 2 | 06-07-2012 03:11 PM |
Range(Cell1,Cell2) Error on another workbook controlling some other workbook? | tinfanide | Excel Programming | 1 | 02-09-2012 04:08 PM |
macro to transfer data from one workbook to another workbook | virsojour | Excel Programming | 5 | 02-01-2011 08:58 PM |
Select a range in one one workbook while working in other workbook | Slow&Steady | Excel | 1 | 02-21-2010 03:34 AM |