...ing logging 4.0

はてなブログに移行しました。D言語の話とかいろいろ。

VBA

区切り文字指定が可能なセル文字列連結関数

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…

指定した文字列を含むセルを検索する関数

VBA

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

match

vlookupの列指定を数値でやってしまうと、列の順序を変えられなくなって困るので、match関数でヘッダから列名を検索することにした。その代わり列名は固定。