Excel has "Event" macros.

Open the VBA Editor.
Select the 'Thisworkbook' "module" in the Project Explorer.
In the VBA editor window, top-left there is a pull-down.
Select Workbook

the default event macro is the Open event.
in the right-hand pulldown, select BeforeSave.

In this macro, test for whatever criteria you wish.
If you want to STOP the saving of the workbook,
set:
Cancel = true

as in:

If (Range("A1").value = "") then Cancel = true


Paul

>
>From: Navneet Singh <[email protected]>
>To: [email protected]
>Sent: Mon, December 13, 2010 8:52:12 AM
>Subject: Re: $$Excel-Macros$$ Macro to Sort
>
>Hi,
>
>Is there a way or VBA Code that can prevent excel from saving.
>
>EG: if any value in cell A1 is not entered or Cell A1 is left blank ,  then i 
>should not be able to save the excel and should get an error message " Please 
>enter value in A1 cell".
>
>Please help... really urgent.
>
>Thanks!
>Navneet
>
>
>On Mon, Dec 13, 2010 at 3:37 AM, robert peloquin <[email protected]> wrote:
>
>Is there a way to? 
>>If B2 thru B8 is complete with all information then Delete info and send to 
>>Sheet 2.
>>With B2 thru B8 now empty then more everything up. Keeping everything 
together.
>>Same thing with rest of info. For example if B18 thru B24 is Incomplete and 
>>B10 
>>thru B16 is complete then Delete and send to Sheet2 then move everything up.
>>By putting the code in a command button? Once clicked will update form? But 
>>don't know how to write the code.
>>Please see attached file.
>>Thanks in Advance!!!Bob and Richard
>>-- 
>>----------------------------------------------------------------------------------
>>
>>Some important links for excel users:
>>1. Follow us on TWITTER for tips tricks and links : 
>>http://twitter.com/exceldailytip
>>2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
>>3. Excel tutorials at http://www.excel-macros.blogspot.com
>>4. Learn VBA Macros at http://www.quickvba.blogspot.com
>>5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
>>
>>To post to this group, send email to [email protected]
>> 
>><><><><><><><><><><><><><><><><><><><><><><>
>>Like our page on facebook , Just follow below link
>>http://www.facebook.com/pages/discussexcelcom/160307843985936?v=wall&ref=ts
>>
>-- 
>----------------------------------------------------------------------------------
>
>Some important links for excel users:
>1. Follow us on TWITTER for tips tricks and links : 
>http://twitter.com/exceldailytip
>2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
>3. Excel tutorials at http://www.excel-macros.blogspot.com
>4. Learn VBA Macros at http://www.quickvba.blogspot.com
>5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
>
>To post to this group, send email to [email protected]
> 
><><><><><><><><><><><><><><><><><><><><><><>
>Like our page on facebook , Just follow below link
>http://www.facebook.com/pages/discussexcelcom/160307843985936?v=wall&ref=ts
>

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to [email protected]

<><><><><><><><><><><><><><><><><><><><><><>
Like our page on facebook , Just follow below link
http://www.facebook.com/pages/discussexcelcom/160307843985936?v=wall&ref=ts

Reply via email to