|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
本帖最后由 banjinjiu 于 2014-8-19 09:06 编辑
查找内容是唯一的。
- Sub 查找45()
- Selection.WholeStory
- Selection.Find.ClearFormatting
- '查找
- With Selection.Find
- .text = "45"
- .Forward = True
- .MatchWildcards = True
- End With
- Selection.Find.Execute
- '移动
- Selection.MoveLeft Unit:=wdCharacter, Count:=1
- '返回"4"左侧的光标位置
- ' Selection.Moveright Unit:=wdCharacter, Count:=1
- '返回"5"右侧的光标位置
- End Sub
复制代码
- Sub 复制st1和st2之间部分()
- Selection.WholeStory
- Selection.Find.ClearFormatting
- '查找
- With Selection.Find
- .text = "st1[!st1]@st2"
- .Forward = True
- .MatchWildcards = True
- End With
- Selection.Find.Execute
- '缩小
- Selection.MoveStart Unit:=wdCharacter, Count:=3
- Selection.MoveEnd Unit:=wdCharacter, Count:=-3
- Set s = Selection.Range
- '复制
- Selection.Copy
- End Sub
复制代码 |
|