Results 1 to 3 of 3

Thread: Need help to add sheet, rename and update in TOC

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Member
    Join Date
    Jun 2013
    Posts
    93
    Rep Power
    13
    it's no reccomended to attach e-mail address, spam risk, please delete
    Code:
    Sub AddSheet()
    Dim ID
    ID = Application.InputBox("Please enter the Patient Number.")
    NewNames = "Patient No - " & ID
    If Not WorksheetExists(NewNames) Then
      Application.ScreenUpdating = False
      With Sheets("Main_1")
        .Visible = True
        .Copy After:=ActiveSheet
        .Visible = False
      End With
      ActiveSheet.Name = NewNames
      Call Create_TOC
      Application.ScreenUpdating = True
    Else
      MsgBox " Sheets exists"
    End If
    End Sub
    Public Function WorksheetExists(ByVal WorksheetName As String) As Boolean
        On Error Resume Next
        WorksheetExists = (Sheets(WorksheetName).Name <> "")
        On Error GoTo 0
    End Function
    Last edited by patel; 07-22-2013 at 11:48 AM.

Similar Threads

  1. Replies: 30
    Last Post: 07-19-2013, 07:52 AM
  2. How to Update Daily Log In Another Sheet
    By Rajesh Kr Joshi in forum Excel Help
    Replies: 6
    Last Post: 04-06-2013, 01:47 PM
  3. Replies: 2
    Last Post: 11-17-2011, 07:49 PM
  4. Rename Filename Through VBA
    By Excel Fox in forum Excel and VBA Tips and Tricks
    Replies: 0
    Last Post: 08-30-2011, 08:29 PM
  5. Add Shape With Hyperlink To Another Sheet
    By Excel Fox in forum Excel and VBA Tips and Tricks
    Replies: 0
    Last Post: 07-30-2011, 04:51 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •