obsidian-notes/工具/Excel.md
CSSC-WORK\murmur 3e6078442b init version
2024-04-15 11:19:57 +08:00

56 lines
1.0 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: Excel
updated: 2022-02-14 06:58:59Z
created: 2022-01-08 13:18:07Z
---
# 位反
无直接函数,可间接实现
bitxor为位异或Byte取反即与0xFF255异或
# 高亮相同数值的单元格
方法有二
一,选择待处理区域,新建条件格式,规则为“使用公式确定要设置格式的单元格”,公式为`=A1=CELL("contents")`设置高亮背景色。关闭后点选单元格按F9刷新即可。
二,需要宏支持。宏代码如下
```vb
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Count <> 1 Then Exit Sub
Dim rng As Range
Dim cnt
cnt = 0
If Target.Count = 1 And Target <> "" Then
Cells.Interior.ColorIndex = -4142
For Each rng In UsedRange
If rng = Target.Value Then
cnt = cnt + 1
rng.Interior.ColorIndex = 44
End If
Next
If cnt = 1 Then Target.Interior.ColorIndex = -4142
'If cnt > 1 Then MsgBox (cnt)
End If
End Sub
```