我需要根据Sheet2上的表替换Sheet1上的值。
我使用Excel 2011 for Mac。是否有一个简单的VBA宏?
答案 0 :(得分:0)
Option Explicit
Public Sub searchAndReplaceFromList()
Dim cel As Range
With Sheet2
For Each cel In Sheet2.Range("A1:A" & .Cells(.Rows.Count, 1).End(xlUp).Row)
Sheet1.UsedRange.Replace cel.Value2, cel.Offset(0, 1).Value2
Next
End With
End Sub