2022年5月

For beginners, the accepted answer is correct, but a little terse if you're not that familiar with either VSC or Regex.

So, in case this is your first contact with either:

To find and modify text,

In the "Find" step, you can use regex with "capturing groups," e.g. I want to find (group1) and (group2), using parentheses. This would find the same text as I want to find group1 and group2, but with the difference that you can then reference group1 and group2 in the next step:

In the "Replace" step, you can refer to the capturing groups via $1, $2 etc, so you could change the sentence to I found $1 and $2 having a picnic, which would output I found group1 and group2 having a picnic.

Notes:

  • Instead of just a string, anything inside or outside the () can be a regular expression.
  • $0 refers to the whole match

来源地址

Sub 疫苗数据清洗()

'其实很简单,原表中看到不到字符都是被缩小了字体,
'以及字体颜色设置成了白色,只要判断其中一个条件,就能取到想要的结果。
'我这里是判断字体颜色为黑色的字符就按原顺序提取出来,放到下面的单元格中。

Dim rng As Range, rg As Range, i&, s$
Dim ofst As Integer
ofst = Sheets(1).Range("A65536").End(xlUp).Row + 3
Set rng = [a1].CurrentRegion
Application.ScreenUpdating = False
For Each rg In rng
  s = ""
  For i = 1 To Len(rg)
    If rg.Characters(Start:=i, Length:=1).Font.Color = vbBlack Then s = s & Mid(rg, i, 1)
  Next i
  rg.Offset(ofst) = s
Next rg
Application.ScreenUpdating = True
End Sub