- Dim currentRow As Long, currentCol As Long
- Dim colorIndex As Long
- If GL Then
- ' 获取当前选中单元格的行号和列号
- ' msgbox("1")
- currentRow = e.RangeSelection.Row
- currentCol = e.RangeSelection.Column
- ' msgbox(currentRow & "12" & currentCol)
- ' 定义要使用的颜色索引(可以根据需要修改)
- colorIndex = 16 ' 例如,使用黄色(索引6)
-
- ' 清除之前的高亮(如果有的话)
- With AW.ActiveWorksheet.UsedRange.Interior
- .Pattern = SpreadsheetGear.Pattern .None
- End With
- ' msgbox("1234")
- ' 高亮显示当前行和列
- If e.RangeSelection.Intersect(Range("T_113")) IsNot Nothing Then
- With e.RangeSelection.EntireRow.Interior
- ' With Range("T_113").Rows(currentRow).EntireRow.Interior
- .colorIndex = colorIndex
- End With
- ' msgbox("12345")
- With e.RangeSelection.EntireColumn.Interior
- ' With Range("T_113").EntireColumn.Interior
- .colorIndex = colorIndex
- End With
- End If
- End If
复制代码 e.RangeSelection.EntireRow.Interior 只能设置到整行 或是整列
|
|
lexianfeng