Many times ranges like 1-4 needs to be expanded. Here is a simple function to do the same.
Function ExpandRanges(ByVal sNoRange As String) As String
Dim arTemp
Dim iLowVal As Integer
Dim iUpVal As Integer
Dim i1 As Integer
Dim sRet As String
If InStr(1, sNoRange, "-") = 0 Then MsgBox "Given No not a Range ": Exit Function
arTemp =
iLowVal = Val(arTemp(0))
iUpVal = Val(arTemp(1))
For i1 = iLowVal To iUpVal
sRet = sRet & "," & i1
Next i1
sRet = Right(sRet, Len(sRet) - 1)
ExpandRanges = sRet
End Function
Expand Ranges in Word
No comments:
Post a Comment