K
Ken McLennan
G'day there One & All,
Back once againg with something not working as I thought.
I have a list that I'm filtering by heading. I'm using the
Worksheet_SelectionChange event to check for the target cell, and then
filter by that criteria. Some of these criteria have a second sort
field, and what I'm trying to do is to alter the heading format to
indicate what's what.
Headings have black text and a light blue background. I want to
alter the format so that the main criteria is bold red text on a pink
back background, with the second sort criteria having the same colors,
but not bold.
The sort is working OK, and the font color is changing to red and
black as I click various cells, but the background color and the bold
property do nothing. No error is thrown, but the code just doesn't do
anything.
Here's what I have:
---[ CODE ] ---
Do some housekeeping,
turn screen updating off,
unprotect sheet,
and then:
This next bit sets base formatting for the header row and appears to
work OK.
With fltrCriteria.Cells
.Interior.Color = 16764057 ' LightBlue
.Font.Color = 0 ' Black
.Font.Bold = False
End With
# ("fltrCriteria" is a named range defining all header cells)
afterwards use the "target" from the sheet event:
Select Case target.Column
Case Is = 2 ' Station
' target.Activate
# (target.activate, and target.select have no effect)
With target.Cells
.Font.Color = 128 ' DarkRed
.Interior.Color = 8421631 ' Pink
.Font.Bold = True
End With
Set tmpCrit = fltrCriteria.Find(Work.Range("F12").Text)
# (determine secondary sort criteria)
With tmpCrit
.Font.Color = 128 ' DarkRed
.Interior.Color = 8421631 ' Pink
.Font.Bold = False
End With
srtShiftList obj_MAINFILTER:=target, obj_SECONDFILTER:=tmpCrit
# (srtShiftList is the sort routine in a standard module - if the
# optional obj_SECONDFILTER is not present then it sorts on a single
# criteria, and only one heading will be coloured red)
I've stepped through the code line by line, there are no errors,
the font.color seems to work OK, but everything else does nothing.
Google led to 3 or 4 different scenarios, but nothing that resolved the
issue. Does anyone have any ideas?
Thanks for listening.
Back once againg with something not working as I thought.
I have a list that I'm filtering by heading. I'm using the
Worksheet_SelectionChange event to check for the target cell, and then
filter by that criteria. Some of these criteria have a second sort
field, and what I'm trying to do is to alter the heading format to
indicate what's what.
Headings have black text and a light blue background. I want to
alter the format so that the main criteria is bold red text on a pink
back background, with the second sort criteria having the same colors,
but not bold.
The sort is working OK, and the font color is changing to red and
black as I click various cells, but the background color and the bold
property do nothing. No error is thrown, but the code just doesn't do
anything.
Here's what I have:
---[ CODE ] ---
Do some housekeeping,
turn screen updating off,
unprotect sheet,
and then:
This next bit sets base formatting for the header row and appears to
work OK.
With fltrCriteria.Cells
.Interior.Color = 16764057 ' LightBlue
.Font.Color = 0 ' Black
.Font.Bold = False
End With
# ("fltrCriteria" is a named range defining all header cells)
afterwards use the "target" from the sheet event:
Select Case target.Column
Case Is = 2 ' Station
' target.Activate
# (target.activate, and target.select have no effect)
With target.Cells
.Font.Color = 128 ' DarkRed
.Interior.Color = 8421631 ' Pink
.Font.Bold = True
End With
Set tmpCrit = fltrCriteria.Find(Work.Range("F12").Text)
# (determine secondary sort criteria)
With tmpCrit
.Font.Color = 128 ' DarkRed
.Interior.Color = 8421631 ' Pink
.Font.Bold = False
End With
srtShiftList obj_MAINFILTER:=target, obj_SECONDFILTER:=tmpCrit
# (srtShiftList is the sort routine in a standard module - if the
# optional obj_SECONDFILTER is not present then it sorts on a single
# criteria, and only one heading will be coloured red)
I've stepped through the code line by line, there are no errors,
the font.color seems to work OK, but everything else does nothing.
Google led to 3 or 4 different scenarios, but nothing that resolved the
issue. Does anyone have any ideas?
Thanks for listening.