Prev: How do I customize hotkeys for excel 2007?
Next: Using "sort" in auto filter not possible when protected?
From: Gord Dibben on 15 Jan 2010 11:48 Private Sub Worksheet_Change(ByVal Target As Range) 'color rows with change in data in column B 'grey, yellow, grey, yellow Dim rngName As Range Dim colIdx As Integer Dim i As Long 'Following assumes column header in row 1 On Error GoTo endit Application.EnableEvents = False Application.ScreenUpdating = False Set rngName = Me.Range(Cells(1, 2), _ Cells(Rows.Count, 2).End(xlUp)) colIdx = 15 'Grey........edit to suit With rngName .Cells(1, 1).EntireRow.Interior.ColorIndex = colIdx 'Starting at 2nd data row For i = 2 To .Rows.Count If .Cells(i) <> .Cells(i - 1) Then If colIdx = 15 Then colIdx = 6 'yellow.....edit to suit Else colIdx = 15 End If End If .Cells(i).EntireRow.Interior.ColorIndex = colIdx Next i End With endit: Application.ScreenUpdating = True Application.EnableEvents = True End Sub Gord On Thu, 14 Jan 2010 23:28:01 -0800, noblight <noblight(a)discussions.microsoft.com> wrote: >If you can tolerate one more question...! > >I decided to move the data that this sorted on to Column B from A. I >tinkered around for a while trying to change this and that in the code, but >can't figure out where you told it to look in Column A for any changes. > >Thanks.
First
|
Prev
|
Pages: 1 2 3 Prev: How do I customize hotkeys for excel 2007? Next: Using "sort" in auto filter not possible when protected? |