Sub Replace2()
Dim XX, a
Worksheets(1).Activate
a = Excel.Application.WorksheetFunction.CountA(Range("A:A"))
For j = 2 To Worksheets.Count
With .Worksheets(j).Activate
For i = 1 To a
XX = Worksheets(1).Range("A" & i).Value
Debug.Print XX
Range("Q:Q,P:P").Select
Selection.Replace What:=XX, Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
Next
Range("Q:Q,P:P").Select
Selection.Replace What:=";;", Replacement:=";", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
Next
End Sub
网友评论