Forum Discussion
danjojackson
Sep 30, 2020Copper Contributor
Minor Workbooks Updating The Main Workbook
Hi All, I'm starting a project to re-do an age old excel system. I have a good understanding of what I want to do but there's one small detail I can't work out. ===EXISTING SYSTEM=== We ha...
Craig Hatmaker
Sep 30, 2020Iron Contributor
Add a timestamp to each minor workbook entry and use the timestamp to order merged records.
Non-VBA method: Request each adviser use this keyboard shortcut.
To insert the current date and time, press Ctrl+; (semi-colon), then press Space, and then press Ctrl+Shift+; (semi-colon).
VBA alternative: Add this code to each minor workbook Sheet1.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim oLo As ListObject
Dim oLR As ListRow
Dim lRow As Long
If Not IsEmpty(Target.Cells(1)) Then
If Not Target.ListObject Is Nothing Then
Set oLo = Target.ListObject
lRow = Target.Cells(1).Row - oLo.HeaderRowRange.Row
Set oLR = oLo.ListRows(lRow)
If IsEmpty(oLR.Range(1)) Then oLR.Range(1) = Now()
End If
End If
End Sub
The VBA alternative assumes each Minor worksheet has a table with a timestamp column like so:
The VBA advantage is the timestamp is entered automatically.
- danjojacksonOct 01, 2020Copper ContributorReally Helpful Craig, Thanks
Was going to research this but you saved me the hassle! Muchos Gracias.
All The Best
Danjo