Dear Ajay, Thanks a lot. It will be of immense use to me. One last thing. Is it possible to refer the cell by cell- name instead of cell address so that it works whenever I save the file from any sheet. E.g. if I name the cell B10 is “BSDIFFERENCE” and in the code I refer it like if “BSDIFFERENCE” <>0, etc. etc.
The problem in giving the reference as B10 is that it checks for the error in every sheet I am working at. Whereas it should check only in the Sheet where Balance Sheet has been prepared. Thanks. From: excel-macros@googlegroups.com [mailto:excel-mac...@googlegroups.com] On Behalf Of Ajay Varshney Sent: Tuesday, June 09, 2009 5:07 PM To: excel-macros@googlegroups.com Subject: $$Excel-Macros$$ Re: WARNING SIGNAL IN CASE OF ERROR Hi Vivek, I told you to write the code under ThisWorkbok but you wrote the code under Sheet1. Check the attached file. On Tue, Jun 9, 2009 at 3:10 PM, vivek jain <vivek.j...@gmail.com> wrote: Dear Ajay, I tried the solution provided by you. But I couldn’t do it. I am attatching the file in which I copied the code provided by you. Please have a look at it and let me know where I went wrong. Thanks & Regards.. CA Vivek Jain From: excel-macros@googlegroups.com [mailto:excel-mac...@googlegroups.com] On Behalf Of Ajay Varshney Sent: Monday, June 08, 2009 7:31 PM To: excel-macros@googlegroups.com Subject: $$Excel-Macros$$ Re: WARNING SIGNAL IN CASE OF ERROR Hi Vivek, Check the attached paint file. This will give you alot of help in getting the required results. Use this VBA Code : Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) If Range("B10").Value <> Range("D10").Value Then Answer = MsgBox("Total of Assets and Liabilities does not match. Press Ok to save or Cancel to edit", vbOKCancel, "Balance Sheet Check Status") If Answer = vbOK Then Exit Sub Else Cancel = True End If End If End Sub Change the highlighted range to cell reference where you have mentioned total of Assets and Liabilities. Regards, Ajay Varshney On Mon, Jun 8, 2009 at 4:54 PM, vivek jain <vivek.j.ca <http://vivek.j.ca/> @gmail.com <http://gmail.com/> > wrote: Dear Ashish, Thanks for the reply. But I have no knowledge about writing macros. So it would be very kind of you if you could elaborate on the solution. Thanks & Regards... Vivek Jain, FCA, DISA (ICAI) Vivek Shantilal Jain & Co. Chartered Accountants 3010 Ram Kumar Arcade, Chatribari Road, A T Road, Guwahati-781001 0361-2603895,9435019908 -----Original Message----- From: excel-macros@googlegroups.com [mailto:excel-mac...@googlegroups.com] On Behalf Of Ashish Jain Sent: Monday, June 08, 2009 2:50 PM To: MS EXCEL AND VBA MACROS Subject: $$Excel-Macros$$ Re: WARNING SIGNAL IN CASE OF ERROR Hi Vivek, Ofcourse this is possible, Use Workbook_BeforeSave event with if condition and warning msg. --------------------------------------- Regards Ashish Jain http://www.excelitems.com <http://www.excelitems.com/> http://www.openexcel.com <http://www.openexcel.com/> *Developer of Open XL* --------------------------------------- On Jun 8, 9:30 am, "vivek jain" <vivek.j...@gmail.com> wrote: > Dear All groupmembers, > > I prepare financial statements in excel. To check whether the balance sheet > tallied I check assets - liabilities in a particular cell which should be > zero and add it to watch window. > > Is it possible that every time I open/save the file it would give me warning > message that my balance sheet does not tally in case of any difference in > assets and liabilities. > > Thanks & Regards... > > cid:image001....@01C85EB8.0483F790 Vivek Jain, FCA, DISA (ICAI) > > Vivek Shantilal Jain & Co. > > Chartered Accountants > > 3010 Ram Kumar Arcade, > > Chatribari Road, A T Road, > > Guwahati-781001 > > (0361-2603895,9435019908 > > image001.gif > 2KViewDownload > > image002.jpg > 1KViewDownload <br --~--~---------~--~----~------------~-------~--~----~ ------------------------------------------------------------------------------------- Some important links for excel users: 1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at http://www.excelitems.com 2. Excel tutorials at http://www.excel-macros.blogspot.com 3. Learn VBA Macros at http://www.vbamacros.blogspot.com 4. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com If you find any spam message in the group, please send an email to: Ayush Jain @ jainayus...@gmail.com or Ashish Jain @ 26may.1...@gmail.com ------------------------------------------------------------------------------------- -~----------~----~----~----~------~----~------~--~---