Last active
August 29, 2015 13:57
-
-
Save rubyonrailsworks/9813554 to your computer and use it in GitHub Desktop.
VBA FOR RACHEL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function GETCITYNAME(district As Range, cities As Range) As String | |
Dim X As Range | |
For Each X In cities | |
If InStr(1, district.Value, X.Value) > 0 Then | |
GETCITYNAME = X.Value | |
Exit For | |
End If | |
Next X | |
End Function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function RIGHTREMOVESTR(cell As Range, str As String) As String | |
Dim Index As Interger | |
rem 获得从右开始匹配字符串的位置,即终止位置 | |
Index = InstrRev(Len(cell.Value), str) | |
rem 获得终止位置之前的字符串 | |
RIGHTREMOVESTR = Left(cell.Value, Index-1) | |
End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment