If your list is a value of items within an excel worksheet, and you want to add tabs based on that list, you COULD do something like this:
Sub Readinto_array()
On Error Resume Next
Dim arrData() As Variant
arrData = Range("D5:D9").Value
For Each cData In arrData
If cData <> "" Then
Worksheets.Add(After:=Worksheets(Worksheets.Count)).Name = cData
Worksheets(cData).Range("B3") = cData
End If
Next cData
End Sub
Assumptions for the above:
- List of names is on same worksheet as the button.
- List is on same workbook as the button.
The Worksheets(cData).Range("B3") = cData
is the part that adds the worksheet name to the new sheet in cell B3
.
If you can specify where your list is located in a simliar manner; if it's not on the same sheet as the button, then specify the proper value in the arrData = Range()
portion of the VBA file, such as: arrData = Worksheets("SourceSheet").Range("D5:D9").Value
.
1This is spot on. – mtone – 2012-01-06T23:32:59.627