Excel 根据名字获取另一个sheet中的数据
Posted 叨叨勋
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Excel 根据名字获取另一个sheet中的数据相关的知识,希望对你有一定的参考价值。
Public Function GetProduct(company_name, postion)
Set d = CreateObject("scripting.dictionary")
last_B = Sheets("Sheet2").Cells(Rows.Count, 1).End(xlUp).Row
bb = Sheets("Sheet2").Range("B1:C" & last_B)
For i = 2 To UBound(bb)
If bb(i, 1) = company_name And Not IsEmpty(bb(i, 2)) And Not IsNull(bb(i, 2)) Then
d(bb(i, 2)) = i
End If
Next
\'On Error GoTo myerr
GetProduct = d.Keys()(postion - 1)
\'myerr:
\'GetProduct = ""
End Function
以上是关于Excel 根据名字获取另一个sheet中的数据的主要内容,如果未能解决你的问题,请参考以下文章