Sub IsoscelesTriangle1_Click() Dim finder As Worksheet, dataws As Worksheet Dim goallastrow As Long, datalastrow As Long, x As Long Dim datarng As Range
设置 finder = ThisWorkbook.Worksheets("Sheet2") 设置 dataws = ThisWorkbook.Worksheets("Sheet1")
目标lastrow = finder.Range("A" & Rows.Count).End(xlUp).Row datalastrow = dataws.Range("A" & Rows.Count).End(xlUp).Row
设置 datarng = dataws.Range("A2:C" & datalastrow)
For x = 2 Togoalslastrow On Error Resume Next finder.Range("C" & x).Value = Application.WorksheetFunction.VLookup(_finder.Range("A" & x).Value, datarng, 2, False)
下一个 x
For x = 2 Togoalslastrow On Error Resume Next finder.Range("i" & x).Value = Application.WorksheetFunction.VLookup(_finder.Range("A" & x).Value, datarng, 3, False)
下一个 x
结束子
对于 vba