突出显示 "True" 矩阵值
Highlight "True" Matrix values
我在 Excel table 中有一个网格,其中的 x 表示产品和功能之间的匹配。这是一个非常大的网格,难以阅读,因此为了改进显示效果,我希望在 select 功能时突出显示相应产品的行。当我 select 一项功能时,我希望突出显示对应功能的行。
如果我的 table 看起来像这样:
Feature 1|Feature 2|Feature 3|
Product 1| x | x | |
Product 2| x | | x |
Product 3| | x | |
例如,在上面的示例中,selecting 功能 2 将突出显示产品 1 和产品 3 的行。而 selecting 产品 1 将突出显示功能 1 和功能 2 .
这是可以通过条件格式完成的事情,还是 VBA 必需的。我一直在尝试使用 =CELL("address") 引用,但是当我 select 一个功能(或 TRUE 功能,当我select 一个产品)。
我的计划是使与以下内容的互动动态化,如果我能弄清楚如何让它发挥作用的话:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.Calculate
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
Dim rng As Range, cell As Range
Me.Cells.Interior.Color = xlNone
If Not Intersect(Range("1:1"), Target) Is Nothing Then
Set rng = Intersect(Me.UsedRange, Columns(Target.Column))
If Not rng Is Nothing Then
For Each cell In rng
If cell.Value = "x" Then Me.Cells(cell.Row, 1).Interior.ColorIndex = 8
Next cell
End If
ElseIf Not Intersect(Range("A:A"), Target) Is Nothing Then
Set rng = Intersect(Me.UsedRange, Rows(Target.Row))
If Not rng Is Nothing Then
For Each cell In rng
If cell.Value = "x" Then Me.Cells(1, cell.Column).Interior.ColorIndex = 8
Next cell
End If
Else
Exit Sub
End If
End Sub
我在 Excel table 中有一个网格,其中的 x 表示产品和功能之间的匹配。这是一个非常大的网格,难以阅读,因此为了改进显示效果,我希望在 select 功能时突出显示相应产品的行。当我 select 一项功能时,我希望突出显示对应功能的行。
如果我的 table 看起来像这样:
Feature 1|Feature 2|Feature 3|
Product 1| x | x | |
Product 2| x | | x |
Product 3| | x | |
例如,在上面的示例中,selecting 功能 2 将突出显示产品 1 和产品 3 的行。而 selecting 产品 1 将突出显示功能 1 和功能 2 .
这是可以通过条件格式完成的事情,还是 VBA 必需的。我一直在尝试使用 =CELL("address") 引用,但是当我 select 一个功能(或 TRUE 功能,当我select 一个产品)。
我的计划是使与以下内容的互动动态化,如果我能弄清楚如何让它发挥作用的话:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.Calculate
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
Dim rng As Range, cell As Range
Me.Cells.Interior.Color = xlNone
If Not Intersect(Range("1:1"), Target) Is Nothing Then
Set rng = Intersect(Me.UsedRange, Columns(Target.Column))
If Not rng Is Nothing Then
For Each cell In rng
If cell.Value = "x" Then Me.Cells(cell.Row, 1).Interior.ColorIndex = 8
Next cell
End If
ElseIf Not Intersect(Range("A:A"), Target) Is Nothing Then
Set rng = Intersect(Me.UsedRange, Rows(Target.Row))
If Not rng Is Nothing Then
For Each cell In rng
If cell.Value = "x" Then Me.Cells(1, cell.Column).Interior.ColorIndex = 8
Next cell
End If
Else
Exit Sub
End If
End Sub