Home>Article>Topics> How to make a cross color change when clicking on a cell in Excel

How to make a cross color change when clicking on a cell in Excel

hzc
hzc Original
2020-06-16 15:41:28 46794browse

How to make a cross color change when clicking on a cell in Excel

1. Open the excel that needs to be edited, as shown in the figure.

How to make a cross color change when clicking on a cell in Excel

#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.

How to make a cross color change when clicking on a cell in Excel

3. Click Development Tools, click VB, and then click the excel table that needs to display the cross color, as shown in the figure.

How to make a cross color change when clicking on a cell in Excel

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.

How to make a cross color change when clicking on a cell in Excel

5. Then close the VB development interface, and the display effect will be as shown in the figure.

How to make a cross color change when clicking on a cell in Excel

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn