|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
楼主这是我第一题的代码
思路应该大体没有问题,可能是代码格式写错了,不好去找
你能指点我一二吗?
Sub 题目查找替换()
Dim i, j As Integer, a As Variant, rng As Range
For i = 3 To 7
For j = 1 To 4
a = Sheets(1).Cells(i, j).Value
Select Case a
Case Is = "*50*"
Range(i, j).Select
Selection.Replace What:="50", Replacement:="55", LookAt:=xlPart
Range(i, j).Interior.ColorIndex = 2
Case Is = "*~~*"
Range(i, j).Select
Selection.Replace What:="~~", Replacement:="00", LookAt:=xlPart
Range(i, j).Interior.ColorIndex = 44
Case Is = "* *"
Range(i, j).Select
Selection.Replace What:=" ", Replacement:="", LookAt:=xlPart
Range(i, j).Interior.ColorIndex = 32
Case Is = "*~**"
Range(i, j).Select
Selection.Replace What:="~*", Replacement:="哈哈", LookAt:=xlPart
Range(i, j).Interior.ColorIndex = 43
Case Is = "**王**"
Range(i, j).Select
Selection.Replace What:="*王*", Replacement:="丫丫", LookAt:=xlPart
Range(i, j).Interior.ColorIndex = 45
Case Is = "*A*"
Range(i, j).Select
Selection.Replace What:="A", Replacement:="Z", LookAt:=xlPart
Range(i, j).Interior.ColorIndex = 7
Case Is = "*R??*"
Range(i, j).Select
Selection.Replace What:="R??", Replacement:="-LOAD", LookAt:=xlPart
Range(i, j).Interior.ColorIndex = 12
Case Is = "*~??*"
Range(i, j).Select
Selection.Replace What:="~??", Replacement:="AA", LookAt:=xlPart
Range(i, j).Interior.ColorIndex = 8
End Select
Next
Next
End Sub
|
|