如果工作表3中的单元格值与工作表2中的单元格值匹配,则工作表2中指定的单元格包含替换为迪士尼DCL或迪士尼WDTC的文本。
Sub changedisney()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim wb As Workbook
Dim ws As Worksheet
Set wb = ActiveWorkbook
Set ws1 = wb.Sheets("April")
Set ws2 = wb.Sheets("alljobs")
Set ws3 = wb.Sheets("New")
x = ws3.Cells(ws3.Rows.Count, 2).End(xlUp).Row
For i = x To 2 Step -1
If ws3.Cells(i, 4) = ws2.Cells(i, 1) And ws2.Cells(i, 7) = "gtb*" Then
ws3.Cells(i, 2) = "Disney DCL"
End If
If ws3.Cells(i, 4) = ws2.Cells(i, 1) And ws2.Cells(i, 7) = "wdtc*" Then
ws3.Cells(i, 2) = "Disney WDTC"
End If
Next i
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub