PC Review


Reply
Thread Tools Rate Thread

Checking if some cells are empty when file is being saved

 
 
Bob Ptacek
Guest
Posts: n/a
 
      29th Apr 2010
Is there something that can be checked if the "Save" function is executed.

I have a file with a number of worksheets and I don't want a user to be able
to save it without entering some data. Once the "save" is selected I would
like to check to see if all required fields are still empty so I can display
an error
 
Reply With Quote
 
 
 
 
FSt1
Guest
Posts: n/a
 
      29th Apr 2010
hi
you could use the before save event to check certain cells for input.
but since you didn't give a lot of details, i can only give a overly simple
answer.
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim r As Range
Set r = Sheets("sheet1").Range("A2")
If r = "" Then
MsgBox "the require entry at " & r.Address & " need data!"
r.Select
Cancel = True
End If
End Sub

the above only check 1 cell and cancels save if no data in the cell.
you would need to reset r to the various cells that need input. not sure how
many you have.

regards
FSt1

"Bob Ptacek" wrote:

> Is there something that can be checked if the "Save" function is executed.
>
> I have a file with a number of worksheets and I don't want a user to be able
> to save it without entering some data. Once the "save" is selected I would
> like to check to see if all required fields are still empty so I can display
> an error

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Empty gridview cells and checking for empty string Savvoulidis Iordanis Microsoft ASP .NET 1 5th Sep 2008 07:15 AM
Checking empty cells Diez Microsoft Excel Programming 1 21st Jun 2006 08:32 AM
Checking for Empty Scattered Cells Kevin O'Neill Microsoft Excel Programming 2 4th Jan 2006 06:41 PM
Checking for empty cells in a range Chris Strug Microsoft Excel Programming 8 21st Jun 2005 12:07 AM
Checking for empty cells in a range Chris Strug Microsoft Excel Worksheet Functions 2 20th Jun 2005 10:33 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:50 AM.