I have my own ribbon, wherein there is one check box. If the checkbox is checked, highlight active row and active column, wherever I move to any cell in any worksheet. It is not working. Help me.
Code
- Public Function FunctionAction(control As IRibbonControl, pressed As Boolean)
- If pressed Then
- Application.Run Worksheet_SelectionChange(ActiveCell)
- ActiveCell.EntireRow.Interior.ColorIndex = 20
- ActiveCell.EntireColumn.Interior.ColorIndex = 20
- 'Call Worksheet_SelectionChange(ByVal Target As Range)
- Else
- Application.Run Worksheet_SelectionChange(ActiveCell)
- ActiveCell.EntireRow.Interior.ColorIndex = 0
- ActiveCell.EntireColumn.Interior.ColorIndex = 0
- End If
- End Function
- Public Function Worksheet_SelectionChange(ByVal Target As Range)
- Cells.Interior.ColorIndex = xlColorIndexNone
- Target.EntireColumn.Interior.ColorIndex = 0 '28
- Target.EntireRow.Interior.ColorIndex = 0 '28
- Target.Interior.ColorIndex = xlColorIndexNone
- End Function