Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-23-2013, 01:28 AM
beginner beginner is offline How to check all cells before saving Workbook Windows 7 32bit How to check all cells before saving Workbook Office 2007
Advanced Beginner
How to check all cells before saving Workbook
 
Join Date: Sep 2011
Location: Europe
Posts: 45
beginner will become famous soon enough
Question 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?
Attached Files
File Type: xls check-cells-before-save.xls (31.0 KB, 9 views)

Last edited by beginner; 04-25-2013 at 01:18 AM. Reason: SOLVED
Reply With Quote
  #2  
Old 04-24-2013, 11:42 PM
macropod's Avatar
macropod macropod is offline How to check all cells before saving Workbook Windows 7 64bit How to check all cells before saving Workbook Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
  #3  
Old 04-25-2013, 01:15 AM
beginner beginner is offline How to check all cells before saving Workbook Windows 7 32bit How to check all cells before saving Workbook Office 2007
Advanced Beginner
How to check all cells before saving Workbook
 
Join Date: Sep 2011
Location: Europe
Posts: 45
beginner will become famous soon enough
Thumbs up 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
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to check all cells before saving Workbook cannot check/uncheck check box but added check box learn2office Word 1 11-27-2012 02:02 AM
How to check all cells before saving Workbook #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
How to check all cells before saving Workbook macro to transfer data from one workbook to another workbook virsojour Excel Programming 5 02-01-2011 08:58 PM
How to check all cells before saving Workbook Select a range in one one workbook while working in other workbook Slow&Steady Excel 1 02-21-2010 03:34 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:42 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft