I am adding worksheets and assigning them a name according to some base list in the original worksheet. This will vary every time, or from time to time, so I need to create a way to explicitly create an array of the new sheets each time without hard-coding.
Easier to understand as follows: essentially the type of code I want to execute goes something like this:
Dim SheetList as Variant
Dim LastRow as Long
Dim Symbol as String
SheetList = Array("Blank"
Sheets("Blank"
.Select
LastRow = Range("A65536"
.end(xlUp).Row
For i = 1 to LastRow
Symbol = Range("B" & i).Value
Sheets.Add
ActiveSheet.Name = Symbol
<potential further code omitted>
SheetList = SheetList union Array(Symbol)
Next i
<now one can work with the array of all sheets that were added>
This would essentially be the same as just looping through the blank sheet and trying to generate the array without even adding the new worksheets every time, but I wanted to give context. The "expression.Union(Arg1, Arg2, ...)" in the help file applies to ranges only, not arrays of sheetnames or strings or whatever.
Please let me know if one has any insights. Thanks in advance!
Cheers,
Aeneas
Easier to understand as follows: essentially the type of code I want to execute goes something like this:
Dim SheetList as Variant
Dim LastRow as Long
Dim Symbol as String
SheetList = Array("Blank"
Sheets("Blank"
LastRow = Range("A65536"
For i = 1 to LastRow
Symbol = Range("B" & i).Value
Sheets.Add
ActiveSheet.Name = Symbol
<potential further code omitted>
SheetList = SheetList union Array(Symbol)
Next i
<now one can work with the array of all sheets that were added>
This would essentially be the same as just looping through the blank sheet and trying to generate the array without even adding the new worksheets every time, but I wanted to give context. The "expression.Union(Arg1, Arg2, ...)" in the help file applies to ranges only, not arrays of sheetnames or strings or whatever.
Please let me know if one has any insights. Thanks in advance!
Cheers,
Aeneas