Dear All,
I am trying to do something like:
Public dynarr() As String
Sub data1()
Size = 3
ReDim arr(Size) As String
For i = 1 To Size Step 1
arr(i) = Cells(i, 1)
Next i
Call data
End Sub
Sub data2()
Size = 7
ReDim arr(Size) As String
For i = 1 To Size Step 1
arr(i) = Cells(i + 10, 1)
Next i
Call data
End Sub
Sub data()
For i = 1 To Size
Cells(i, 2) = arr(i)
Next i
End Sub
But, it's asking to redefine the dimension of arr(). Am I doing wrong or it's not possible to define dynamic array in a way, I did. Actually I have one common code after reading all the data (user selected, so the row selection is random) from worksheets. So, trying to redimension arr() in each macro and then do operate in a common macro.
Any help will be appreciated.
I am trying to do something like:
Public dynarr() As String
Sub data1()
Size = 3
ReDim arr(Size) As String
For i = 1 To Size Step 1
arr(i) = Cells(i, 1)
Next i
Call data
End Sub
Sub data2()
Size = 7
ReDim arr(Size) As String
For i = 1 To Size Step 1
arr(i) = Cells(i + 10, 1)
Next i
Call data
End Sub
Sub data()
For i = 1 To Size
Cells(i, 2) = arr(i)
Next i
End Sub
But, it's asking to redefine the dimension of arr(). Am I doing wrong or it's not possible to define dynamic array in a way, I did. Actually I have one common code after reading all the data (user selected, so the row selection is random) from worksheets. So, trying to redimension arr() in each macro and then do operate in a common macro.
Any help will be appreciated.