View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
mariasa[_10_] mariasa[_10_] is offline
external usenet poster
 
Posts: 1
Default Creating 64 new wsheets and naming them in vba


Hi guys,

I have a list of 66 fund numbers and would like excel to create the
number of new worksheets within my workbook equal to the number of
funds (66) minus 2 (that is 64) since 3 already exist and I am using
the 1st one for the general info.

Then I would like excel to name the new worksheets appropriately
looping through a range of fund numbers (they are not consecutive
numbers so excel has to loop through them on my general info page)

So this is the task.

Here is the list of funds on my sheet1

Fund Number
172
175
203
204
219
229
256
261
267
269
272
284
285
292
293
309
332
338
351
561
581
582
601
614
616
620
622
624
632
636
637
640
662
684
687
688
693
706
709
713
801
806
818
824
828
830
831
839
848
860
863
864
865
869
870
871
872
891
931
939
941
942
943
947
949
953

and this is what I have so far in my vba:every time i run it, it
creates just one extra sheet and gives me a subscript out of range
error message.

Sub CommandButton1_Click()

Dim counter As Integer

For counter = 3 To 66
Sheets.Add
Sheets("counter").Select
Sheets("counter").Name = "counter"
Next counter
End Sub

Thank you, guys!!!

Best,
Maria


--
mariasa
------------------------------------------------------------------------
mariasa's Profile: http://www.excelforum.com/member.php...o&userid=31726
View this thread: http://www.excelforum.com/showthread...hreadid=521661