遍历工作表查找字符串并替换 VBA EXCEL
如图1所示,、假设在名称为“1”的工作表中,遍历该工作表所有单元格。将查找到含有“照明”字符串的单元格,统一替换成如图2所示的效果。用VBA编写谢谢各位!...
如图1所示,、假设在名称为“1”的工作表中,遍历该工作表所有单元格。
将查找到含有“照明”字符串的单元格,统一替换成如图2所示的效果。
用VBA编写
谢谢各位! 展开
将查找到含有“照明”字符串的单元格,统一替换成如图2所示的效果。
用VBA编写
谢谢各位! 展开
1个回答
展开全部
Range("A1").Select
Selection.Copy
Cells.Find(What:="*照明*", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, MatchByte:=False, SearchFormat:=False).Activate
Cells.FindNext(After:=ActiveCell).Activate
Cells.FindNext(After:=ActiveCell).Activate
Cells.FindNext(After:=ActiveCell).Activate
Cells.FindNext(After:=ActiveCell).Activate
Cells.FindNext(After:=ActiveCell).Activate
Cells.FindNext(After:=ActiveCell).Activate
ActiveCell.Replace What:="*照明*", Replacement:="马尼公司照明*30倍", LookAt:= _
xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Cells.FindNext(After:=ActiveCell).Activate
ActiveCell.Replace What:="*照明*", Replacement:="马尼公司照明*30倍", LookAt:= _
xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Cells.FindNext(After:=ActiveCell).Activate
ActiveCell.Replace What:="*照明*", Replacement:="马尼公司照明*30倍", LookAt:= _
xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Cells.FindNext(After:=ActiveCell).Activate
ActiveCell.Replace What:="*照明*", Replacement:="马尼公司照明*30倍", LookAt:= _
xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Cells.FindNext(After:=ActiveCell).Activate
ActiveCell.Replace What:="*照明*", Replacement:="马尼公司照明*30倍", LookAt:= _
xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Cells.FindNext(After:=ActiveCell).Activate
Selection.Copy
Cells.Find(What:="*照明*", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, MatchByte:=False, SearchFormat:=False).Activate
Cells.FindNext(After:=ActiveCell).Activate
Cells.FindNext(After:=ActiveCell).Activate
Cells.FindNext(After:=ActiveCell).Activate
Cells.FindNext(After:=ActiveCell).Activate
Cells.FindNext(After:=ActiveCell).Activate
Cells.FindNext(After:=ActiveCell).Activate
ActiveCell.Replace What:="*照明*", Replacement:="马尼公司照明*30倍", LookAt:= _
xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Cells.FindNext(After:=ActiveCell).Activate
ActiveCell.Replace What:="*照明*", Replacement:="马尼公司照明*30倍", LookAt:= _
xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Cells.FindNext(After:=ActiveCell).Activate
ActiveCell.Replace What:="*照明*", Replacement:="马尼公司照明*30倍", LookAt:= _
xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Cells.FindNext(After:=ActiveCell).Activate
ActiveCell.Replace What:="*照明*", Replacement:="马尼公司照明*30倍", LookAt:= _
xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Cells.FindNext(After:=ActiveCell).Activate
ActiveCell.Replace What:="*照明*", Replacement:="马尼公司照明*30倍", LookAt:= _
xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Cells.FindNext(After:=ActiveCell).Activate
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询