Function FNC_strrev(mode_sel As Integer, inp_str As String, sep_str As String) As String
'-------------------------------------------------------------------------------
'   文字列取り出し検索文字の後ろ(右)から検索して、検索文字の前または後ろの文字列を返す
'
'   mode_sel      0:検索文字の前(左)の文字列を返す
'                 1:検索文字の後ろ(右)の文字列を返す
'
'   inp_str       検索対象
'   sep_str       検索する文字
'   戻り値　      取り出した文字列
'
'   ※「検索する文字」は1文字の想定です。複数桁の場合は修正してください
'-------------------------------------------------------------------------------

    Dim sepLen As Integer   '検索文字列の文字数
    Dim sepPos As Integer   '検索文字列の開始位置
    Dim datLen As Integer   '対象文字列の文字数
    
    '戻り値　初期化
    FNC_strrev = ""
    
     'エラー回避(該当無し)
    If InStr(inp_str, sep_str) > 0 Then
        
        '[検索対象文字列]の文字数を取得
        datLen = Len(inp_str)
        
        '[検索文字列]の文字数を取得
        sepLen = Len(sep_str)
        
        '検索文字を後ろ(右)から検索する
        sepPos = InStrRev(inp_str, sep_str)
        
        '戻り値　セット
        If mode_sel = 0 Then
            '検索文字の前を取り出す
            FNC_strrev = Left(inp_str, sepPos - 1)
        Else
            '検索文字の後ろを取り出す
            FNC_strrev = Right(inp_str, datLen - sepPos)
        End If
    End If

End Function