在Cell A1中,我有一台计算机的描述(HDD,Proccessor,GFX等),在单元格B1-10中我有一个proccessors列表,我想要的是一个excel UDF,它会在单元格C1中像这样讨论:
GetProccessor(A1,B1:B10)
我知道我需要在VBA中解析:
函数GetProccessor(Text as Variant,rRange as Range)
然后我被卡住,因为我对范围循环非常差,有人可以给我一些指示吗?
答案 0 :(得分:0)
获取零件功能,自己完成!
Function GetPart(text As Variant, rCells As Range)
Dim txt As String
Dim rRange As Range
Dim SubjCell
For Each rRange In rCells
SubjCell = rRange
txt = text
If InStr(txt, SubjCell) <> 0 Then
GetPart = SubjCell
Exit For
Else
GetPart = "Not Found"
End If
Next rRange
End Function