View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
meg99 meg99 is offline
external usenet poster
 
Posts: 10
Default Help with creating code??

On Nov 6, 11:43 am, Mekinnik
wrote:
I am looking for some help on creating code to do the following.
1)create a new sheet from a formated(already created) sheet
2)name the new sheet what the combobox selection is, if it already exsists
have it alow the user to select another name
3)select the data(stored on two other sheets) for the new sheet based off of
a combobox selection
4)copy the data to the new sheet
And the kicker is I want all this to happen with the click of a button

=========================
Create a menu button and attach this code:

Sub CopySheet()
NewName = InputBox("New Name")
If NewName = "" Then
Exit Sub
End If

ActiveSheet.Copy befo=Sheets(2)
NewSheet = ActiveSheet.Index
SheetCount = Sheets.Count
IsNewName = False
Do Until IsNewName = True
For s = 1 To SheetCount
If Sheets(s).Name = NewName Then
NewName = InputBox("New Name")
Exit For
End If
Next s
IsNewName = True
Loop
Sheets(NewSheet).Name = NewName
End Sub

Hope this helps

meg99