Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default How do I prevent saving an excel file if cells are blank?

How do I prevent saving an excel file if cells are blank?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,123
Default How do I prevent saving an excel file if cells are blank?

Hi Leighann

You can use the before save event

Copy this event in the Thisworkbook module
Change the sheet name and ranges in this line
Set myrange = Worksheets("Sheet1").Range("A1:A6,C10,D12,G1:G3")

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim myrange As Range
Set myrange = Worksheets("Sheet1").Range("A1:A6,C10,D12,G1:G3")
If Application.WorksheetFunction.CountA(myrange) < _
myrange.Cells.Count Then
MsgBox "fill in all cells"
Cancel = True
End If
End Sub



--
Regards Ron de Bruin
http://www.rondebruin.nl



"Leighann" wrote in message ...
How do I prevent saving an excel file if cells are blank?



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel file not saving properly Noma Jane Dill Excel Discussion (Misc queries) 2 August 26th 06 06:26 AM
how to remove blank cells in excel Landa Excel Discussion (Misc queries) 7 August 13th 06 07:29 AM
importing a particular excel worksheet into another excel file dinouk Excel Worksheet Functions 0 August 10th 06 02:03 PM
Excel Outlook Attachments opening after several errors everytime cito_support Setting up and Configuration of Excel 2 March 13th 06 06:15 PM
saving excel file as tab delimited Craig Hilliard Excel Discussion (Misc queries) 0 February 1st 05 10:39 PM


All times are GMT +1. The time now is 11:03 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"