1. Open the excel that needs to be edited, as shown in the figure.
#2. First, check the development tool in the custom function in the excel option. If there is already a development tool in the ribbon, this operation is not required, as shown in the figure.
3. Click Development Tools, click VB, and then click the excel table that needs to display the cross color, as shown in the figure.
4,
Private Sub Worksheet_SelectionChange(ByVal Target As Range) Cells.Interior.ColorIndex = xlNoneTarget.EntireRow.Interior.ColorIndex = 4Target.EntireColumn.Interior.ColorIndex = 4End Sub
Note: 4 represents the code of the display color. If you need other colors, you can check the excel color code on Baidu and change it. .
Copy the above code to a blank area and click Save. You need to save excel as a macro-enabled workbook, that is, .xlsm format. The cross color effect will also be displayed when opening the excel, as shown in the figure.
5. Then close the VB development interface, and the display effect will be as shown in the figure.
Recommended tutorial: "excel tutorial"
The above is the detailed content of How to make a cross color change when clicking on a cell in Excel. For more information, please follow other related articles on the PHP Chinese website!