嗨,我是新的Excel宏。我想爲vlookup創建一個宏,以便我可以應用到很多單元格,但它不起作用。Excel宏vba上vlookup公式
Sub haha()
Dim wb As Workbook
Dim ws, ws1 As Worksheet
Set wb = ActiveWorkbook
Set ws = ActiveWorkbook.Sheets(1)
Set ws1 = ActiveWorkbook.Sheets(2)
wb.Activate
ws1.Select
Range("E1").Formula = "=+VLOOKUP(" & ws1.Range("C6") & "," & ws.Range("c7:d10") & ",2,FALSE)"
End sub
我想在當前工作表中查找一個值到另一個工作表的範圍以返回唯一值。請幫忙! :)
在vlookup中的兩個範圍之後放置'.Address'。 –
注意謝謝! – koky