excel鼠标点击单元格字体变颜色 取消选择后恢复 并返回选中单元格的行数

2024-12-05 18:37:51
推荐回答(1个)
回答1:

行数不就是,都是1嘛?
是列号?
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim tr, tc
tr = Target.Row
tc = Target.Column
If tr > 1 And tc > 4 Then Exit Sub
Range("A1:D1").Font.ColorIndex = 0
Target.Font.ColorIndex = 5

[A2] = tc '显示选择单元格的列号
End Sub