Highlight cell which has been edited recently?

kvmike

New Member
Joined
Feb 28, 2022
Messages
11
Office Version
  1. 365
Platform
  1. Windows
Is there any way to highlight a cell that has been edited recently? (e.g. within the last 14 days)
I am working with a report that potentially changes on a weekly basis which is shared on teams with some colleagues.
A lot of the time there may be minimal changes, but there is a lot of data so it can be difficult to notice things looking through manually.

I tried searching around but no luck so far :(

Is this something that can be done through VBA?
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Would the review changes feature not be sufficient or the highlighting is necessary?
 
Upvote 0
One way: save history of change from sheet "Data" in a sheet named "log"
Sheet "Data":
I am testing with this: the range of cells those changing need to be fired: A1:A8 & C6:F22 (and more...)
A sub to records the original value in sheet "Log":
Insert/ new module. Assign this scrip in a button "Original"
VBA Code:
Option Explicit
Sub origin() ' to update the new original data
Dim k&, rng As Range, cell As Range, data As Worksheet, Logs As Worksheet
Set data = Worksheets("Data"): Set Logs = Worksheets("Log")
Set rng = Union(data.Range("A1:A8"), data.Range("C6:F22"))
    For Each cell In rng
        k = k + 1
        Logs.Cells(k + 2, 2).Value = cell.Address(0, 0)
        Logs.Cells(k + 2, 3).Value = Date + Time
        Logs.Cells(k + 2, 4).Value = cell.Value
    Next
End Sub

Sheet "Log": to records any change from those cells, time by time
Put this code in sheet "Data" : worksheet_Change even
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range) ' to records every change in yellow range
Dim k&, nw As String, f, rng As Range, cell As Range, data As Worksheet, Logs As Worksheet
Set data = Worksheets("Data"): Set Logs = Worksheets("Log")
Set rng = Union(data.Range("A1:A8"), data.Range("C6:F22")) 'add more ranges if needed
    If Not Intersect(Target, rng) Is Nothing Then
        nw = Target.Address(0, 0) 'address of changing cell
        Set f = Logs.Range("A:A").Find(nw)
        f.End(xlToRight).Offset(0, 1).Value = Date + Time
        f.End(xlToRight).Offset(0, 1).Value = Target
    End If
End Sub
Book1
ABCDEFGHIJ
12
22
33
44
55
6690101112
7713141516
8817181920
9300222324
1025262728
1129303132
1233343536
1337383940
1441424344
1545464748
1649505152
1753545556
1857585960
1961626364
2065666768
2169707172
2273747576
23
Data

Book1
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACAD
1days of last changeOriginal DataLog
2Cell AddressTimeStampOriginal ValueTimeStampValueTimeStampValueTimeStampValueTimeStampValueTimeStampValueTimeStampValueTimeStampValueTimeStampValueTimeStampValueTimeStampValueTimeStampValueTimeStampValueTimeStampValue
3 A122/03/2022 14:30:301
4 A222/03/2022 14:30:302
5 A322/03/2022 14:30:303
6 A422/03/2022 14:30:304
7 A522/03/2022 14:30:305
8 A622/03/2022 14:30:306
9 A722/03/2022 14:30:307
10 A822/03/2022 14:30:308
11 C622/03/2022 14:30:309
12 D622/03/2022 14:30:3010
13 E622/03/2022 14:30:3011
14 F622/03/2022 14:30:3012
15 C722/03/2022 14:30:3013
16 D722/03/2022 14:30:3014
17 E722/03/2022 14:30:3015
18 F722/03/2022 14:30:3016
19 C822/03/2022 14:30:3017
20 D822/03/2022 14:30:3018
21 E822/03/2022 14:30:3019
22 F822/03/2022 14:30:3020
230C922/03/2022 14:30:302122/03/2022 15:1220022/03/2022 15:15300
24 D922/03/2022 14:30:3022
25 E922/03/2022 14:30:3023
26 F922/03/2022 14:30:3024
27 C1022/03/2022 14:30:3025
28 D1022/03/2022 14:30:3026
29 E1022/03/2022 14:30:3027
30 F1022/03/2022 14:30:3028
31 C1122/03/2022 14:30:3029
32 D1122/03/2022 14:30:3030
33 E1122/03/2022 14:30:3031
34 F1122/03/2022 14:30:3032
35 C1222/03/2022 14:30:3033
36 D1222/03/2022 14:30:3034
37 E1222/03/2022 14:30:3035
38 F1222/03/2022 14:30:3036
39 C1322/03/2022 14:30:3037
40 D1322/03/2022 14:30:3038
41 E1322/03/2022 14:30:3039
42 F1322/03/2022 14:30:3040
43 C1422/03/2022 14:30:3041
44 D1422/03/2022 14:30:3042
45 E1422/03/2022 14:30:3043
46 F1422/03/2022 14:30:3044
47 C1522/03/2022 14:30:3045
48 D1522/03/2022 14:30:3046
49 E1522/03/2022 14:30:3047
50 F1522/03/2022 14:30:3048
51 C1622/03/2022 14:30:3049
52 D1622/03/2022 14:30:3050
53 E1622/03/2022 14:30:3051
54 F1622/03/2022 14:30:3052
55 C1722/03/2022 14:30:3053
56 D1722/03/2022 14:30:3054
57 E1722/03/2022 14:30:3055
58 F1722/03/2022 14:30:3056
59 C1822/03/2022 14:30:3057
60 D1822/03/2022 14:30:3058
61 E1822/03/2022 14:30:3059
62 F1822/03/2022 14:30:3060
63 C1922/03/2022 14:30:3061
64 D1922/03/2022 14:30:3062
65 E1922/03/2022 14:30:3063
66 F1922/03/2022 14:30:3064
67 C2022/03/2022 14:30:3065
68 D2022/03/2022 14:30:3066
69 E2022/03/2022 14:30:3067
70 F2022/03/2022 14:30:3068
71 C2122/03/2022 14:30:3069
72 D2122/03/2022 14:30:3070
73 E2122/03/2022 14:30:3071
74 F2122/03/2022 14:30:3072
75 C2222/03/2022 14:30:3073
76 D2222/03/2022 14:30:3074
77 E2222/03/2022 14:30:3075
78 F2222/03/2022 14:30:3076
Log
Cell Formulas
RangeFormula
A3:A78A3=IFERROR(DATEDIF(C3,INDEX($E3:$AD3,AGGREGATE(14,6,(COLUMN($E$2:$AD$2)-4)/($E$2:$AD$2="TimeStamp")/($E3:$AD3>0),1)),"d"),"")
 
Upvote 0
Hi, you may be able to save to a log file:
Just as I was posting bebo0219999 post came through, so you could use his code combined with mine to add the original data versus only seeing the range in the log file.

VBA Code:
Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)

    Dim myString As String, FN As Byte
    Dim filePath As String, myFileName As String
    Dim cdt_time, ntTime, ntDate
    
    cdt_time = Now()
    ntTime = Format(cdt_time, "hh:mm:ss")
    ntDate = Format(cdt_time, "dd-MMM-yyyy")
    
    filePath = "c:\Sage\"
    myFileName = "logTest.txt"
    
    myString = ntDate & "   " & ntTime & "   " & Target.Address
    FN = 1
    Open filePath & myFileName For Append As #FN
    Print #FN, myString
    Close #FN
    
End Sub
 

Attachments

  • forWorksheetLog.jpg
    forWorksheetLog.jpg
    40.2 KB · Views: 8
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top