Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Greetings
My code: Private Sub CommandButton1_Click() ' ' Dim sNewSheet As String sNewSheet = Range("I10").Value On Error Resume Next If SheetExists(sNewSheet) = True Then MsgBox "A requestRequest already exists for" & sNewSheet Else Sheets("template").Select Sheets("template").Copy After:=Worksheets(Worksheets.Count) Cells.Select Selection.Copy Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Range("A1").Select ActiveSheet.Name = Range("i10").Value ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True End If On Error GoTo 0 End Sub Function SheetExists(SName As String, _ Optional ByVal WB As Workbook) As Boolean 'Chip Pearson On Error Resume Next If WB Is Nothing Then Set WB = ThisWorkbook SheetExists = CBool(Len(WB.Sheets(SName).Name)) End Function What do I need to add so the button is not copied to the new sheet? Thanks! |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
copy rows from one Data sheet to another sheet based on cell conte | Excel Discussion (Misc queries) | |||
Auto Copy/autofill Text from sheet to sheet if meets criteria | Excel Discussion (Misc queries) | |||
Search for rows in one sheet and copy into another sheet based on customer id | Excel Worksheet Functions | |||
relative sheet references ala sheet(-1)!B11 so I can copy a sheet. | Excel Discussion (Misc queries) | |||
providing a sheet-copy event or copy CustomProperties | Excel Programming |