![](https://iknow-base.cdn.bcebos.com/lxb/notice.png)
在excel中选中某个单元格后该单元格所在的行与列都能高亮颜色显示?
2个回答
展开全部
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Cells.Interior.Color = xlNone
If Target.Count > 1 Then
Exit Sub
Else
Target.EntireColumn.Interior.Color = vbGreen
Target.EntireRow.Interior.Color = vbGreen
End If
End Sub
右键工作表标签》查看代码,复制粘贴以上代码》关闭新弹出的窗口》回到excel中,点击单元格测试效果~
展开全部
Private Sub Worksheet_Change(ByVal Target As Range)
If Application.CutCopyMode <> False Then
Application.CutCopyMode = False
End If
Call colorset(Target)
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Application.CutCopyMode = False Then
Call colorset(Target)
Else
Exit Sub
End If
End Sub
Private Sub colorset(ByVal rngtarget As Range)
If rngtarget.Count > 1 Then
Cells.Interior.ColorIndex = 0
Exit Sub
End If
Rows.Interior.ColorIndex = 0
x = ActiveCell.Row
y = ActiveCell.Column
Rows(x).Interior.ColorIndex = 20
Columns(y).Interior.ColorIndex = 35
ActiveCell.Interior.ColorIndex = 15
End Sub
复制以上就可以了
If Application.CutCopyMode <> False Then
Application.CutCopyMode = False
End If
Call colorset(Target)
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Application.CutCopyMode = False Then
Call colorset(Target)
Else
Exit Sub
End If
End Sub
Private Sub colorset(ByVal rngtarget As Range)
If rngtarget.Count > 1 Then
Cells.Interior.ColorIndex = 0
Exit Sub
End If
Rows.Interior.ColorIndex = 0
x = ActiveCell.Row
y = ActiveCell.Column
Rows(x).Interior.ColorIndex = 20
Columns(y).Interior.ColorIndex = 35
ActiveCell.Interior.ColorIndex = 15
End Sub
复制以上就可以了
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询