how to get change history in VBA

Z

Z.J. Da

Is there any way to get change history in VBA. We can get
it from history sheet, but the sheet is not updated
quickly enough.

The purpose for me to get the history is to obtain old
value and cell ID in sheetChange handler. Is there any
other way to get them instead of from histroy?

Thank you in advance,

Z.J.
 
J

J.E. McGimpsey

One way:

Dim gOldCellValue As Variant

Private Sub Workbook_SheetChange(ByVal Sh As Object, _
ByVal Target As Excel.Range)
MsgBox "Old: " & gOldCellValue & vbNewLine & _
"New: " & Target.Value
gOldCellValue = Target.Value
End Sub

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, _
ByVal Target As Excel.Range)
gOldCellValue = Target.Value
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top