Microsoft excel sets the row and column styles and cross styles when the mouse clicks on the cell

One, use plug-ins

Square grid http://www.ffcell.com/home/products.aspx

 

 

 

Second, use the vb function

I have been using Microsoft office products. When the text content is too much in excel, the rows and columns cannot be accurately positioned. I want to add a cross mark style.

1. Right-click the worksheet and click to view the code

 

2. Double-click thisWorkbook to open the workbook, add the following event methods, and then close and save.

'注意此方法会去掉单元格已有的背景色
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
    Cells.Interior.ColorIndex = xlNone
    Target.EntireRow.Interior.Color = RGB(230, 250, 230) '行样式
    Target.EntireColumn.Interior.Color = RGB(230, 250, 230) '列样式
    Target.Interior.Color = RGB(255, 255, 255) '单元格样式
End Sub

 

 

 

 

Guess you like

Origin blog.csdn.net/wangjz2008/article/details/114033479