Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'Function - show and replace string inside brackets - v1.xls
- 'This example replaces the index inside brackets.
- 'Useful when a command must read more components
- 'of what is the default in the Export file
- '============================================================
- Function ReplaceIndex(str As String, iDel As String, fDel As String, newIdx As String)
- 'this function replaces the index inside brackets and replace is with
- Dim midStr As String
- On Error GoTo error1
- midStr = Mid(str, WorksheetFunction.Find(iDel, str) + 1, _
- WorksheetFunction.Find(fDel, str) _
- - WorksheetFunction.Find(iDel, str) - 1)
- ReplaceIndex = WorksheetFunction.Replace(str, WorksheetFunction.Find(iDel, str) _
- + 1, Len(midStr), newIdx)
- Exit Function
- error1:
- ReplaceIndex = "Incorrect delimiter"
- Application.Calculate
- End Function
Advertisement
Add Comment
Please, Sign In to add comment