在excel中选中某个单元格后该单元格所在的行与列都能高亮颜色显示?

 我来答
hbpaoxiao2
2015-08-19 · TA获得超过2901个赞
知道大有可为答主
回答量:1962
采纳率:72%
帮助的人:904万
展开全部
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中,点击单元格测试效果~

平安健康快乐mR6
推荐于2016-03-03 · TA获得超过4271个赞
知道大有可为答主
回答量:7221
采纳率:42%
帮助的人:945万
展开全部
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
复制以上就可以了
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式