mr2bart

Board Regular
Joined
Dec 18, 2014
Messages
57
Hi all,
I am trying to find a simple way to highlight changes on excel files.
I found in Microsoft VBA help this points:
like
activeworkbook.keephistorychange
activeworkbook.changehistoryduration
activeworkbook.highlightchangesoptions

but nothing works, even changehistoryduration is kept to 0 when I try to change to 7.

Does these features are enable for excel?

Thanks!
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Have you had a look at using the Track Changes feature ??
To turn on try

Turn on Excel Track Changes feature
On the Review tab, in the Changes group,
click the Track Changes button, and then select Highlight Changes....
In the Highlight Changes dialog box, do the following: Check the Track changes while editing. ...
 
Upvote 0
.
Paste this in ThisWorkbook module :

Code:
Option Explicit


Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)


Dim Oldvalue As String
Dim Newvalue As String


Application.EnableEvents = True


Application.EnableEvents = False
Newvalue = Target.Value
Application.Undo
Oldvalue = Target.Value


    If Oldvalue = "" Then
        Target.Value = Newvalue
    Else
        If InStr(1, Oldvalue, Newvalue) = 0 Then
            Target.Value = Oldvalue & ", " & Newvalue
        Else:
            Target.Value = Oldvalue
        End If
            
    End If
Application.EnableEvents = True


'Change font color to yellow
Target.Interior.Color = vbYellow


ActiveCell.Offset(0, 1).Select    'change cusor position after yellow cell


Application.ScreenUpdating = True
End Sub

Insert a module and paste this (clears out the highlighted cells that were colored yellow due to change) :

Code:
Option Explicit
Sub UnColorCells()


     'Macro purpose:  To uncolor all yellow cells
          
    Dim cl As Range, ws As Worksheet, lColor As Long
     
     'Set the cell color that you want to protect
    lColor = 6
    
    'Cycle through each worksheet in the workbook
    
    For Each ws In ActiveWorkbook.Worksheets
        For Each cl In ws.UsedRange
             
            If cl.Interior.ColorIndex = lColor Then
                cl.Interior.ColorIndex = 0
            End If
        Next cl
    Next ws
     
End Sub


Also for consideration, if you want to track the changes that others make and you want to keep it hidden, there are other macros to accomplish it.
 
Upvote 0
Hi both,
Thanks very much for your prompt feedback.
So for the excel integrated function, yes, I forgot to check the REVIEW menus. I need study further how to use it, I afraid it will conflict with my own other macros.
For the coding solution, yes also, I did already very similar point to highlight by color, and I improved it thanks to your more optimized/expert coding way.
THANKS!!!
 
Upvote 0

Forum statistics

Threads
1,215,039
Messages
6,122,799
Members
449,095
Latest member
m_smith_solihull

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