+ Reply to Thread
Results 1 to 5 of 5

Changed or Updated property?

  1. #1
    Stefi
    Guest

    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. #2
    Tom Ogilvy
    Guest

    Re: 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" <[email protected]> wrote in message
    news:[email protected]...
    > 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. #3
    Excelerate-nl
    Guest

    RE: 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. #4
    Excelerate-nl
    Guest

    RE: 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. #5
    Stefi
    Guest

    RE: 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1