Problems with a Macro.

Hello. I have this macro to log cell changes:

Dim PreviousValue
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count = 1 Then
If Target.Value <> PreviousValue Then
Sheets("log").Cells(65000, 1).End(xlUp).Offset(1, 0).Value = _
Application.UserName & " changed cell " & Target.Address _
& " from " & PreviousValue & " to " & Target.Value
Sheets("log").Cells(65000, 1).End(xlUp).Offset(0, 1).Value = Now
End If
End If
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
PreviousValue = Target.Value
End Sub

And it works fine when i put the value manually.
But i have a import table from a website, and when i click update all from the website the changes don't appears on log sheet.
Anybody have a solution? Thanks for your help

AttachmentSize
prove.xlsm20.73 KB
Vishesh's picture

Please check in the code of

Please check in the code of the update macro if
'Application.EnableEvents = True'
is written anywhere.

RE:

Hello.Thank you for your reply.
I don't have any code for update, simply i go to one excel optics as says update all.
Thanks

Vishesh's picture

There seems to be something

There seems to be something running in the background on clicking the Update All.

Could you pls share the sample file ?

And another problem

An the cell values it depends from another cells with a formula don't save the changes in log.I wait your reply.Thanks for all

Nick's picture

y.. the beautiful code (from

y.. the beautiful code (from here:19. VBA Tips - Log An Audit Trail )

will only work for manual changes... i.e. when someone types something in.

It's possible to implement what you're asking, but requires quite a bit of thought and work.

Request a Quote

 

 

re:

Yes, i started with this example and i try to modify the code to have this but i don't know.Do you any simple idea?thanks

Re:

Hello.
added to post
I wait your reply.Thanks for all.