方法:
1,excel中,按Alt+F11,打开VBA编辑界面,双击需要改的工作表名称,将下面代码粘贴到右边框中,即可。
Private Sub Worksheet_SelectionChange(ByVal Target As Range) Cells.Interior.ColorIndex = 0 Rows(Target.Row).Interior.ColorIndex = 34 End Sub
2,如果想变颜色,改代码的值:ColorIndex的值。
3,ColorIndex值列表:
无色 | 0 | 19 | 38 | ||
1 | 20 | 39 | |||
白色 | 2 | 21 | 40 | ||
3 | 22 | 41 | |||
4 | 23 | 42 | |||
5 | 24 | 43 | |||
6 | 25 | 44 | |||
7 | 26 | 45 | |||
8 | 27 | 46 | |||
9 | 28 | 47 | |||
10 | 29 | 48 | |||
11 | 30 | 49 | |||
12 | 31 | 50 | |||
13 | 32 | 51 | |||
14 | 33 | 52 | |||
15 | 34 | 53 | |||
16 | 35 | 54 | |||
17 | 36 | 55 | |||
18 | 37 | 56 |
联系客服