Excel/Excel: need macro that changes font color after editing the cell then back to default after 24 hours
Just wonder if Excel VBA is possible to change the font color from default (Black) to red of a cell from columns G and H after editing it? And after 24 hours it changes back to default color when the workbook opens.
Thanks in advance.
Right-click the sheet tab, select View Code, enter this:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 7 Or Target.Column = 8 Then
Target.Font.Color = RGB(255, 0, 0)
SaveSetting "Elaine", "T1", Target.Address(0, 0), Now
In the "ThisWorkbook" section (right-click "Thisworkbook" in the VBE), select View Code, enter this:
Private Sub Workbook_Open()
For Each thing In Range("G:H").SpecialCells(xlCellTypeConstants)
If thing.Font.Color = RGB(255, 0, 0) Then
x = GetSetting("Elaine", "T1", thing.Address(0, 0), "")
If x <> "" Then If Now - TimeValue(x) >= 1 Then Range(thing.Address).Font.Color = RGB(0, 0, 0)
That should do it,.
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here