开发者

Excel UDF Loop to find specific value from a string in a range

In Cell A1 i have a description of a computer (HDD, Proccessor, GFX etc) and in cells B1-开发者_Go百科10 i have a list of proccessors, what i want is an excel UDF that would looke like this in cell C1:

GetProccessor(A1,B1:B10)

I know i need to parse in in VBA with:

Function GetProccessor(Text as Variant, rRange as Range)

Then i am stuck as i am very poor with range loops, could anyone give me some pointers?


Get Parts Function, worked it out myself!

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜