![]() |
#1
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
@macropod thank you for answering and macro
Macro works correctly Last edited by beginner; 04-25-2013 at 01:17 AM. Reason: SOLVED |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
learn2office | Word | 1 | 11-27-2012 02:02 AM |
![]() |
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 |
![]() |
virsojour | Excel Programming | 5 | 02-01-2011 08:58 PM |
![]() |
Slow&Steady | Excel | 1 | 02-21-2010 03:34 AM |