CutString1

Cuts a string from a string starting from a specific character index and until a specific character index

Function CutString1(CutFrom, Optional Start1 = 1, Optional End1 = 1) As String
 ' Cuts a string from a string starting from a specific character index and until a specific character index
 ' Start1 is no to cut from (included)
 ' End1 is no to stop cut to (included)
 ' CutFrom is the string to cut from
 ' If Start1 is not given, it will be assumed as 1
 ' If End1 is not given, it will be assumed as the length of the string.
 Dim St1, En1
 CutString1 = ""
 St1 = 1
 If Start1 < Len(CutFrom) Then St1 = Start1
 En1 = Len(CutFrom) + 1
 If End1 = 1 Then GoTo Step3
 If End1 < Len(CutFrom) Then En1 = End1 + 1
Step3:
 CutString1 = Mid(CutFrom, St1, En1 - St1)
End Function

CutFrom, Optional Start1, Optional End1

Views 1005 Downloads 338

'ANStr', 'CutString', 'ANString', 'character', 'index'

ANmarAmdeen
333
Texts + Strings VBA
Revisions

v1.0