I have some code provided here and trying to understand and learn from the examples which are great. Can someone explain the following Dim values
Dim S$(), N&, A%, T$(3), b%
for the above statement what do these do?
S$()
N&
A%
T$(3)
b%
W = [Sheet1!A1].CurrentRegion.Value2
at the conclusion of this statement what values is actually stored in W?
ReDim S(1 To Rows.Count, 1): S(1, 0) = W(1, 1): S(1, 1) = W(1, 2)
I know this reDim S(1,Value) but what do these do?
S(1, 0) = W(1, 1):
S(1, 1) = W(1, 2)
Any help would be greatly appreciated
The code this is pulled from looks like this
Sub Demo2()
Dim W, S$(), N&, K&, V, L$(), r$(), A%, T$(3), b%, C%, D%
W = [Sheet1!A1].CurrentRegion.Value2
ReDim S(1 To Rows.Count, 1): S(1, 0) = W(1, 1): S(1, 1) = W(1, 2)
N = 1
For K = 2 To UBound(W)
For Each V In Split(W(K, 2), ",")
L = Split(V, "-")
If UBound(L) = 1 Then
r = Split(L(1), ".")
L = Split(L(0), ".")
If UBound(L) = 3 And UBound(r) = 3 Then
For A = L(0) To r(0)
T(0) = A
For b = -L(1) * (A = L(0) * 1) To IIf(A < r(0) * 1, 255, r(1))
T(1) = b
For C = -L(2) * (b = L(1) * 1) To IIf(b < r(1) * 1, 255, r(2))
T(2) = C
For D = -L(3) * (C = L(2) * 1) To IIf(C < r(2) * 1, 255, r(3))
T(3) = D
N = N + 1
S(N, 0) = W(K, 1)
S(N, 1) = Join(T, ".")
Next D, C, b, A
End If
Else
N = N + 1
S(N, 0) = W(K, 1)
S(N, 1) = V
End If
Next V, K
[Sheet1!A1:B1].Resize(N).Value2 = S
End Sub
Dim S$(), N&, A%, T$(3), b%
for the above statement what do these do?
S$()
N&
A%
T$(3)
b%
W = [Sheet1!A1].CurrentRegion.Value2
at the conclusion of this statement what values is actually stored in W?
ReDim S(1 To Rows.Count, 1): S(1, 0) = W(1, 1): S(1, 1) = W(1, 2)
I know this reDim S(1,Value) but what do these do?
S(1, 0) = W(1, 1):
S(1, 1) = W(1, 2)
Any help would be greatly appreciated
The code this is pulled from looks like this
Sub Demo2()
Dim W, S$(), N&, K&, V, L$(), r$(), A%, T$(3), b%, C%, D%
W = [Sheet1!A1].CurrentRegion.Value2
ReDim S(1 To Rows.Count, 1): S(1, 0) = W(1, 1): S(1, 1) = W(1, 2)
N = 1
For K = 2 To UBound(W)
For Each V In Split(W(K, 2), ",")
L = Split(V, "-")
If UBound(L) = 1 Then
r = Split(L(1), ".")
L = Split(L(0), ".")
If UBound(L) = 3 And UBound(r) = 3 Then
For A = L(0) To r(0)
T(0) = A
For b = -L(1) * (A = L(0) * 1) To IIf(A < r(0) * 1, 255, r(1))
T(1) = b
For C = -L(2) * (b = L(1) * 1) To IIf(b < r(1) * 1, 255, r(2))
T(2) = C
For D = -L(3) * (C = L(2) * 1) To IIf(C < r(2) * 1, 255, r(3))
T(3) = D
N = N + 1
S(N, 0) = W(K, 1)
S(N, 1) = Join(T, ".")
Next D, C, b, A
End If
Else
N = N + 1
S(N, 0) = W(K, 1)
S(N, 1) = V
End If
Next V, K
[Sheet1!A1:B1].Resize(N).Value2 = S
End Sub