当前位置: 代码迷 >> Office >> 截取字符串函数解决办法
  详细解决方案

截取字符串函数解决办法

热度:5582   发布时间:2013-02-26 00:00:00.0
截取字符串函数
取最后一个"\"前的字符这个函数怎么写
例如:
银行存款\工商银行\北京
银行存款\工商银行\上海
银行存款\建设银行
银行存款\农业银行

返回的结果应该是:
银行存款\工商银行
银行存款\工商银行
银行存款
银行存款





------解决方案--------------------------------------------------------
VB code
Function getStr(str As String)    getStr = Split(WorksheetFunction.Substitute(str, "\", "/", WorksheetFunction.Max(UBound(Split(str, "\")), 1)), "/")End Function
  相关解决方案