I regularly distribute spreadsheets to a number of people and take their updates, consolidate them and prepare a report.
To quickly spot updated fields, I take (for example) columns A-E and copy them to AA-AE, then apply conditional formatting on columns A-E so that if the cell (for example) B5 does not match AB5 then the B5 cell is highlighted in bold red.
Here's the VBA that I use:
Generally speaking, this works well and handles strings, numbers, and dates. The only problem comes when someone "messes about" with the contents of columns AA-AE.
Is it possible to set up the VBA so that, instead of referencing the offset column, I can actually plug into the formula the current value. I can do this Format > Conditional Formatting ... and typing in a constant (i.e., the value that is currently in the cell) but this manual approach simply isn't practical for more than a handful of cells.
Constraints: I need to code to handle numbers, strings, dates and blank cells. By convention, if my users want to clear out a value in the cell and change the cell from something to nothing then they put in "DEL" so I can see that it has changed.
Additional: If you can suggest VBA code that works on a column at a time or on the full range of cells, that would be an excellent learning for me.
To quickly spot updated fields, I take (for example) columns A-E and copy them to AA-AE, then apply conditional formatting on columns A-E so that if the cell (for example) B5 does not match AB5 then the B5 cell is highlighted in bold red.
Here's the VBA that I use:
Code:
lngRowLast = Cells.SpecialCells(xlCellTypeLastCell).Row
lngColLast = 5 ' Adjust to reflect number of actual data columns
For lngRow = 2 To lngRowLast 'Row 1 has headings
For lngCol = 1 To lngColLast
Cells(lngRow, lngCol).Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add _
Type:=xlCellValue, Operator:=xlNotEqual, _
Formula1:="=A" & Mid("ABCDEFGHIJKLMNOPQRSTUVWXYZ", lngCol, 1) _
& CStr(lngRow)
With Selection.FormatConditions(1).Font
.Bold = True
.Italic = False
.ColorIndex = 3
End With
Next
Next
Is it possible to set up the VBA so that, instead of referencing the offset column, I can actually plug into the formula the current value. I can do this Format > Conditional Formatting ... and typing in a constant (i.e., the value that is currently in the cell) but this manual approach simply isn't practical for more than a handful of cells.
Constraints: I need to code to handle numbers, strings, dates and blank cells. By convention, if my users want to clear out a value in the cell and change the cell from something to nothing then they put in "DEL" so I can see that it has changed.
Additional: If you can suggest VBA code that works on a column at a time or on the full range of cells, that would be an excellent learning for me.