Rick, using the following code from Jim Cone modified by me:
Sub FigureItOut()
Dim N As Long
Dim m As Long
Dim X As Long
Dim A As Long
Dim strWhat As String
Dim strGiven As String
Dim vThings As Variant
Dim strArr() As String
ReDim strArr(1 To 100, 1 To 3)
'some extras in the string
strGiven = "-9'Min. Int.'!F26-'Min.-7
Int.'!F31+28038.66^35+[C:\123]'Clos-6ing'!E3^1"
vThings = Array("-", "+", "^", "/", "*")
m = 0
For N = 0 To UBound(vThings)
Do
m = InStr(m + 1, strGiven, vThings(N), vbBinaryCompare)
If m > 0 Then
If Mid$(strGiven, m + 1, 1) Like "#" Then
A = m + 1
strWhat = Mid$(strGiven, m, 2)
Do
strWhat = strWhat & IIf(Mid$(strGiven, A + 1, 1) Like "#"
Or _
Mid$(strGiven, A + 1, 1) = ".", Mid$(strGiven, A + 1, 1),
"")
A = A + 1
Loop While Mid$(strGiven, A + 1, 1) Like "#" Or
Mid$(strGiven, A + 1, 1) = "."
X = X + 1
strArr(X, 1) = strWhat
strArr(X, 2) = m
strArr(X, 3) = Len(strArr(X, 1))
Debug.Print "CharPlusSign: "; strArr(X, 1) & Space(5) &
"StartPosInStr: " & _
strArr(X, 2) & Space(5) & "StrLength: " & strArr(X, 3)
End If
Else
Exit Do
End If
Loop
Next
'ReDim Preserve strArr(1 To X)
End Sub
I tried (and it worked) "ReDim strArr(1 To 100, 1 To 3)" but I have 100
elements.
Is there way to Preserve the array above so that I have six "items" each
with 3 elements?
EagleOne
Rick Rothstein said:
Just to clarify Bob's comment... you can only ReDim the 2nd dimension when
using the Preserve keyword. Without the Preserve keyword, you can change
any
dimension, or even the number of dimensions, but doing so, of course,
loses
any stored information.