Hi all
I’ve created a simple to-do list in Excel that re-sorts automatically, triggered by a change in some columns. And there lies my problem…
The columns that do *not* trigger a change contain either drop-down lists or a check box for “Complete” status (and each check box’s corresponding “TRUE” or “FALSE” in the adjoining cell). If I change the cell contents in any of the other columns (i.e. with the keyboard, cut, paste, etc.), the sort is triggered perfectly. But making a drop-down box selection or changing a check box won’t do it (BTW: I have used “form” check boxes rather than “control” check boxes, as I am not a programming type, and found these easy to implement).
I’d be very grateful indeed if anyone could suggest to me what I need to do so that making a drop-down list selection or changing a check box’s state will also trigger the autosort – I have attached the code that is attached to the worksheet (i.e. not a macro).
And while we’re at it, can anyone suggest why conditional formatting works strangely when its condition is the “TRUE / FALSE” associated with the check box. If I select the formula to be checked as an absolute reference (e.g. $g$2), it works fine – but if that row changes position, the source of the conditional format will then be wrong. And if I select it as a variable reference, only some of the cells take on the conditional formatting.
Here’s the code (the check boxes are in column F and the TRUE/FALSE in column G):
Private Sub Worksheet_Change(ByVal Target As Range)
Range(“A:G”).Sort Key1:=Range(“G2”), Order1:=xlAscending, Key2:=Range(“e2”), Order1:=xlAscending, Key3:=Range(“b2”), Order1:=xlAscending, Header:=xlYes, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
I also tried doing this check for changes to values in the check boxes or their TRUE/FALSE values using this:
If Target.Column 7 Then Exit Sub
Changing the target column value to any of the other columns worked fine – so I guess it operates on text changes only???
Thanks & best regards
Neil