Solved

Do you want to save changes you made to 'xxxx.xls'?

Posted on 2010-08-18
7
497 Views
Last Modified: 2012-06-22
Hi,
When i close an excell document each time it prompts me "do you want to save changes you made to" even though no modification have been made.Pls help
0
Comment
Question by:vnunkoo
  • 3
  • 2
7 Comments
 
LVL 50

Expert Comment

by:Ingeborg Hawighorst
ID: 33462871
Hello vnunkoo,

this can be caused by volatile formulas like

=now()
=today()

and many others, or by macros that force a re-calculation of the sheet, even if nothing has changed.

Look for volatile formulas, look for macros. Post the file (replacing confidential information with dummy data) if you can't find it.

cheers, teylyn
0
 

Author Comment

by:vnunkoo
ID: 33463041
Hi teylyn,
when i remove the formulas it doesnt prompt me for the message. But i need these formulas. Is there an option to disable the msg. Thanks.
0
 
LVL 50

Accepted Solution

by:
Ingeborg Hawighorst earned 250 total points
ID: 33463302
In short: No.

If you use functions like NOW() or TODAY()  ( or OFFSET() or many other functions....), they will be recalculated and will update whenever the sheet re-calculates. Whenever you open a workbook, the sheets will be recalculated. So the cell values change, and when you close the workbook, Excel will ask if you want to save the changes.

You can set calculation to "manual", but then you need to remember to hit F9 to calculate the sheet after you have changed the data.

This is a case of "eating your cake and still having it in your hand". You can't have both.

cheers, teylyn
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 7

Expert Comment

by:MSmax
ID: 33463662
Hi,
You can also use below code which needs to be placed into ThisWorkbook Object (Alt+F11).
Code will automaticaly save the file on close.



Private Sub Workbook_Beforeclose(Cancel As Boolean)



    Application.DisplayAlerts = False

    

    ThisWorkbook.Save



    Application.DisplayAlerts = True

    

End Sub

Open in new window

0
 
LVL 50

Expert Comment

by:Ingeborg Hawighorst
ID: 33463706
Msmax's suggestion effectively takes away the user's decision whether or not they want to save changes.

Any changes.

Regardless of whether the "changes" are just re-calculated formulas because the time/date is now different from the last time the workbook was opened, or whether the user actually changed any data manually.

I'm not to sure I'd want to change the workbook without notice, if, for example, the user has just accidentally deleted large parts of the data.  With MSmax's suggestion, the changes will be saved without asking for confirmation.

With the suggestion posted above, you do not have any control over whether to save or not. No matter what damage the user has done to the workbook, it will be save WITHOUT ANY WARNING.

Not a good idea.

cheers
0
 
LVL 7

Assisted Solution

by:MSmax
MSmax earned 250 total points
ID: 33464312
telyn of course you right this is not the best idea if thetre is more users using the file and this will do exactly as you described.

vnunkoo you can use one of the sheets as some sort of log to store session changes - if no changes made file will close without saving and error message.

Please see below code for details.
Ps. First 2 parts need to go to ThisWorkbook object, the third one to all Sheets but log (Sheet3 in this example)

Private Sub Workbook_Open()



Dim user As String

Dim ws As Worksheet

Dim lr As Long



'Enable Errors

Application.DisplayAlerts = True



'Sheet3 will keep track of changes

Set ws = ThisWorkbook.Worksheets("Sheet3")



lr = ws.Range("H" & Rows.Count).End(xlUp).Row + 1





user = Environ("UserName")



'record user name and session open

ws.Range("H" & lr & ":I" & lr).Value = Array(user, Date & " " & Time)



End Sub



Private Sub Workbook_Beforeclose(Cancel As Boolean)

    

    Dim user As String

    Dim ws As Worksheet

    Dim lr As Long, lr1 As Long, ls As Date

    Dim cnt As Long



    Set ws = ThisWorkbook.Worksheets("Sheet3")



    lr1 = ws.Range("H" & Rows.Count).End(xlUp).Row



    ws.Range("J" & lr1).Value = Date & " " & Time

    

    ls = ws.Range("I" & lr1).Value

    

    lr = ws.Range("A" & Rows.Count).End(xlUp).Row

    

    cnt = WorksheetFunction.CountIf(ws.Range("D2:D" & lr), ">" & ls)

    

    If cnt = 0 Then

        Application.DisplayAlerts = False

    End If

    

End Sub



Private Sub Worksheet_Change(ByVal Target As Range)



Dim user As String

Dim adr As String

Dim val1 As Variant

Dim ws As Worksheet

Dim lr As Long



Set ws = ThisWorkbook.Worksheets("Sheet3")



lr = ws.Range("A" & Rows.Count).End(xlUp).Row + 1



user = Environ("UserName")

adr = Target.Address

val1 = Target.Value



ws.Range("A" & lr & ":D" & lr).Value = Array(user, adr, val1, Date & " " & Time)



End Sub

Open in new window

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Drop Down List with Unique/Distinct Values (Part II - ComboBox or ListBox and Data Validation List Bonus!) David Miller (dlmille) Intro This article focuses on delivering unique, sorted lists to list objects (e.g., ComboBox, ListBox) and Dat…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now