Excel

Display Changed Cells in Red Font

Ease of Use

Easy

Version tested with

2000 

Submitted by:

byundt

Description:

All cells that were changed in the workbook since the Tools...Track Changes menu item was turned on will be displayed in a red font. 

Discussion:

When submitting spreadsheets for review by third parties, it is desirable to highlight the changes made since the last review. Highlighting or changing font color manually is tedious (and it's easy to overlook a change or two that you've made). The Tools...Track Changes menu item doesn't change the printed version of the spreadsheet at all, and the black triangles it uses as markers are easily missed when you are scrolling around a lengthy spreadsheet. This code has two requirements: 1) The workbook being examined must have the Track Changes feature turned on. This is found on the Tools menu item. Turning on Track Changes will Share the workbook, as well. 2) The macro must be in a different workbook from the one being examined. 

Code:

instructions for use

			

Sub ChangesInRed() 'Makes font color red for all cells marked as 'changed' by Tools...Track Changes _ feature The Tools...Track Changes feature must be turned on For the workbook being _ examined Macro must be In a different workbook than the one being examined Workbook _ being examined will be saved when the macro begins executing Dim cel As Range Dim wsName As String, celAddr As String Dim ws As Worksheet Dim wb As Workbook Set wb = ActiveWorkbook With wb 'Test if macro is being applied to ThisWorkbook If .Name = ThisWorkbook.Name Then MsgBox Title:="Error message", prompt:="This macro will not work on " & _ "the same workbook that contains the macro." & Chr(10) & _ "Please click on a cell in a different workbook using the " & _ "Track Changes feature" Exit Sub End If 'Test if Track Changes feature is turned off in Shared workbook If .KeepChangeHistory = False Then GoTo errhandler Application.ScreenUpdating = False Application.DisplayAlerts = False 'Display all changes as list on History worksheet '(which will be the last one in the workbook) On Error GoTo errhandler 'If workbook hasn't been saved after initiating the TrackChanges feature 'History worksheet can't be opened .Save .HighlightChangesOptions When:=xlAllChanges, Who:="Everyone" .ListChangesOnNewSheet = True .HighlightChangesOnScreen = True .Worksheets(.Worksheets.Count).Columns("F:G").Copy End With 'Paste list of changes in new sheet in this workbook ThisWorkbook.Activate ThisWorkbook.Worksheets.Add Set ws = ActiveSheet ws.Range("F1").PasteSpecial Application.CutCopyMode = False 'Go through list of changes and color each affected cell red For Each cel In Range(Cells(2, 6), Cells(65536, 6).End(xlUp)).Cells wsName = cel.Value celAddr = cel.Offset(0, 1).Value wb.Worksheets(wsName).Range(celAddr).Font.ColorIndex = 3 'Mark changes in red Next cel ActiveSheet.Delete 'Delete the list of changes from this workbook wb.Activate 'Don't display list of changes in separate worksheet wb.ListChangesOnNewSheet = False Application.DisplayAlerts = True Application.ScreenUpdating = True On Error GoTo 0 Exit Sub errhandler: MsgBox Title:="Error message", prompt:="Track changes feature must " & _ "be turned on for active workbook" On Error GoTo 0 Application.DisplayAlerts = True Application.ScreenUpdating = True Exit Sub End Sub

How to use:

  1. Copy the code above.
  2. Open a workbook.
  3. Hit Alt+F11 to go to the Visual Basic Editor (VBE).
  4. Choose Insert-Module from the menu.
  5. Paste the code into the code window at right.
  6. Close the VBE.
 

Test the code:

  1. The macro and a sample workbook are in the attached file. The macro is in workbook Track changes in red.xls; the sample is workbook Track changes.xls. Open both workbooks.
  2. Click on any cell in Track changes.xls workbook.
  3. ALT + F8, then double-click Changes in Red to run that macro. After a few moments, all changes made to the sample workbook will now appear in a red font
 

Sample File:

Track changes in red + sample.zip 18.27KB 

Approved by mdmackillop


This entry has been viewed 445 times.

Please read our Legal Information and Privacy Policy
Copyright @2004 - 2020 VBA Express