joannevanderwest
New Member
- Joined
- Jul 12, 2019
- Messages
- 3
Hi
I am struggling to declare and fill in a global/public array.
Here is my code
Public Function myArray() As Variant
Dim WS_Count As Integer
Dim i As Integer
Dim x As Integer
Let x = 0
WS_Count = ActiveWorkbook.Worksheets.Count
For i = 1 To WS_Count
If Left(ActiveWorkbook.Worksheets(i).Name, 5) = "Sheep" Then
ReDim Preserve myArray(x) As Variant
myArray(x) = Worksheets(i).Name
x = x + 1
End If
Next i
End Function
I am getting Redim errors
I have a userform with a button. Everytime I click the button I want to go to the next array and then save information to the tab. ( The array is the tabname)
I am a newbie
Thank you
I am struggling to declare and fill in a global/public array.
Here is my code
Public Function myArray() As Variant
Dim WS_Count As Integer
Dim i As Integer
Dim x As Integer
Let x = 0
WS_Count = ActiveWorkbook.Worksheets.Count
For i = 1 To WS_Count
If Left(ActiveWorkbook.Worksheets(i).Name, 5) = "Sheep" Then
ReDim Preserve myArray(x) As Variant
myArray(x) = Worksheets(i).Name
x = x + 1
End If
Next i
End Function
I am getting Redim errors
I have a userform with a button. Everytime I click the button I want to go to the next array and then save information to the tab. ( The array is the tabname)
I am a newbie
Thank you