View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
ahmed abd elemgeed ahmed abd elemgeed is offline
external usenet poster
 
Posts: 1
Default About Creating a series of sheets based on a mastersheet (#master)











How are you

About Creating a series of sheets based on a master sheet (#master)
At the sheet1 I write from B1 to B10 lp1, lp2,lp3,…….till lp10 and create CommandButton1 And use this following operation to make copy of sheet master with new names as lp1, lp2,lp3,…….till lp10

Private Sub CommandButton1_Click()

Dim i As Long

For i = 1 To 50

If Cells(i, 2) = 0 Then

Exit For

Else

Sheets("Master").Copy After:=Sheets(Sheets.Count)

Sheets("Master (2)").Name = Cells(i, 2)

End If

Next i

End Sub





After I apply the previous Creating a series of sheets based on a master sheet (#master) with CommandButton1 at second press I have error

The question how I can avoid this error at the second press (for example someone press by error????

The second question is if I write at the cells B11,B15

New text lp11,lp12, what is the function added to previous function to make after written or adding lp11,lp12 the excel vba under stand insert new sheets lp11,lp12 added to lp1 to lp10 sheets and so on if I ad any names of sheets in column by and press button the new names sheets while added?????