tags:

views:

114

answers:

1

In Cell A1 i have a description of a computer (HDD, Proccessor, GFX etc) and in cells B1-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?

A: 

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
Sam