Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default Changed or Updated property?

Hi All,

Is there any way to check if any cells in a worksheet has been changed? I
want to use a Worksheet_Deactivate() event, but only if there was a change in
the sheet to avoid lengthy processing.

Thanks,
Stefi

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Changed or Updated property?

You could save the file on the activate event (or change Thisworkbook.Saved
= true). then in the deactivate event, you could check Thisworkbook.Saved.
If true, no change. If false, there has been a change. [Lightly tested]

Other than that you would have to detect the change yourself (possibly using
the change event).

Note that changing Thisworkbook.Saved can affect the prompt to save before
closing.

--
Regards,
Tom Ogilvy

"Stefi" wrote in message
...
Hi All,

Is there any way to check if any cells in a worksheet has been changed? I
want to use a Worksheet_Deactivate() event, but only if there was a change

in
the sheet to avoid lengthy processing.

Thanks,
Stefi



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Changed or Updated property?

Hi Stefi,

This may work, but you have to use an intermediate cell somewhere to store
the status of the sheet:

(macro's in sheet1)
Private Sub Worksheet_Change(ByVal Target As Range)
Sheet1.Range("a1").Value = True
End Sub

Private Sub Worksheet_Deactivate()
If Sheet1.Range("a1").Value Then
MsgBox "Sheet has been changed"
Else
End If
End Sub

Regards,
Excelerate
Jan Bart

"Stefi" wrote:

Hi All,

Is there any way to check if any cells in a worksheet has been changed? I
want to use a Worksheet_Deactivate() event, but only if there was a change in
the sheet to avoid lengthy processing.

Thanks,
Stefi

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Changed or Updated property?

Sorry,

First reply is wrong. Use This instead:

You should use another sheet to store the data

Private Sub Worksheet_Change(ByVal Target As Range)
Sheet2.Range("a1").Value = True
End Sub

Private Sub Worksheet_Deactivate()
If Sheet2.Range("a1").Value Then
MsgBox "Sheet has been changed"
Sheet2.Range("a1").Value = False
Else
End If
End Sub

"Excelerate-nl" wrote:

Hi Stefi,

This may work, but you have to use an intermediate cell somewhere to store
the status of the sheet:

(macro's in sheet1)
Private Sub Worksheet_Change(ByVal Target As Range)
Sheet1.Range("a1").Value = True
End Sub

Private Sub Worksheet_Deactivate()
If Sheet1.Range("a1").Value Then
MsgBox "Sheet has been changed"
Else
End If
End Sub

Regards,
Excelerate
Jan Bart

"Stefi" wrote:

Hi All,

Is there any way to check if any cells in a worksheet has been changed? I
want to use a Worksheet_Deactivate() event, but only if there was a change in
the sheet to avoid lengthy processing.

Thanks,
Stefi

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default Changed or Updated property?

Many thanks to both of you Tom and Jan, both solution are clever workarounds!
Nonetheless I suggest Microsoft to build in a new "Updated" property in some
later version!

Regards,
Stefi

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 cells randomly don't get updated unless each cell is updated Lost in Excel Excel Discussion (Misc queries) 5 September 29th 08 06:56 PM
Format changed when the details in cell changed angel Excel Worksheet Functions 9 July 15th 08 12:36 AM
MultiPage Form data not displaying when Value property changed Jim Zeeb[_2_] Excel Programming 2 September 6th 05 08:48 PM
Runtime Error 380 – Could not set the list property. Invalid property value BernzG[_16_] Excel Programming 2 August 21st 05 10:10 PM
Runtime error 380: Could not set the List property. invalid property value of listbox jasgrand Excel Programming 0 October 6th 04 09:28 PM


All times are GMT +1. The time now is 02:01 PM.

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

About Us

"It's about Microsoft Excel"