Sub BBB()
Sheet1.Select
Range("A1").Select
For X = 2 To 4
If 1 = 1 Then
M = Sheet1.Cells(X, 1)
mymax = Evaluate("VLOOKUP(""" & M & """,工作表2!A:B,2,FALSE)")
If Application.IsError(mymax) = True Then mymax = ""
Sheet1.Cells(X, 2) = mymax
End If
Next
End Sub作者: cclo0728 時間: 2020-6-10 08:15
再給兩種方法:
Sub TTT1()
R& = [託外報表!A65536].End(xlUp).Row
With [託外報表!B2].Resize(R - 1)
.FormulaR1C1 = "=VLOOKUP(RC[-1],'託外報表(總表)'!C[-1]:C,2,0)"
.Value = .Value
.Replace "#N/A", ""
End With
End Sub
Sub TTT2()
R& = [託外報表!A65536].End(xlUp).Row
With Sheets("託外報表").Range("B2:B" & R)
.FormulaR1C1 = "=VLOOKUP(RC[-1],'託外報表(總表)'!C[-1]:C,2,0)"
.Value = .Value
.Replace "#N/A", ""
End With
End Sub作者: cclo0728 時間: 2020-6-11 16:01