VBA
Function join(r As Range, sep As String) As String Dim result As String Dim c As Range For Each c In r If c.Value <> "" Then result = result & c.Value & sep End If Next c If Len(result) = 0 Then join = "" Else join = Left(result, Len(resul…
Function FINDCELL(r As Range, str As String) As Object Dim theCell As Object Set theCell = r.Cells.Find(str, LookAt:=xlPart) If theCell Is Nothing Then Set FINDCELL = Nothing Else Set FINDCELL = theCell End If End Function
vlookupの列指定を数値でやってしまうと、列の順序を変えられなくなって困るので、match関数でヘッダから列名を検索することにした。その代わり列名は固定。