Results 1 to 3 of 3

Return to page where code was started

Threaded View

  1. #1
    Forum Contributor
    Join Date
    09-09-2008
    Location
    Middlesbrough, England
    MS-Off Ver
    2007
    Posts
    174

    Return to page where code was started

    Hi,

    I have a VB code which is run from a worksheet called "Marco" this code duplicates the "Template" worksheet and re-names it in DDMM format.

    The active cell appears on the newly created sheet. I would like the VB to return to the "Macro" worksheet to complete the 2nd Stage. Can anyone advise what needs to be tweaked with the below code?

    Sub AddSheets_Today()
         '   Add and name a sheet with today's date
        Dim szToday As String
         
         '   Date Stamp:
        szToday = Format(Date, "DDMM")
         
        On Error GoTo MakeSheet
         
         '   Check if sheet already exists:
         '   if it does, select activate it
        Sheets(szToday).Activate
         
         '   No errors, we are done
        Exit Sub
         
         
    MakeSheet:
         '   If the sheet doesn't exist:
         '   Add it
         '   Name it
        Worksheets("Template").Copy After:=Worksheets(Worksheets.Count)
        ActiveSheet.Name = szToday
    End Sub
    Last edited by batchy; 10-07-2011 at 06:30 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1