Results 1 to 3 of 3

Copy Sheets from a template

Threaded View

  1. #1
    Registered User
    Join Date
    01-15-2008
    Posts
    16

    Copy Sheets from a template

    Hello-

    I have a workbook in which I have a sheet labeled "Week 1" and a hidden sheet labeled "Template." The user enters a beginning date and an end date in a dialog box. I am using a date format, "ww," to determine the number of weeks between those dates. I then subtract the one week out to account for the "Week 1" sheet. I need to take that integer and create a loop to copy the hidden template sheet that number of times. The desired result is a workbook with tabs labeled "Week 1" through "Week x," determined by a beginning date and an end date. It looks something like this but I don't have it in front of me.
    Sub IDontKnowWhatImDoing
    
    Dim a as integer
    Dim b as integer
    Dim c as integer
    
    a = Format(txtStart.Text,ww)
    b = Format(txtEnd.Text,ww)
    
    c = (b-a)-1
    
    'It works up to this point.  c calculates.  Here's where I get confused.  I feel 'like it has do with not linking the counter up to the sheets
    
    For d = 2 to c
    Worksheets("Template").Visible = True
    Worksheets("Template").Copy
    Worksheets("Template").Visible = False 
    Next d
    
    End Sub

    Any help is appreciated. Thank you.
    Last edited by royUK; 07-12-2008 at 03:00 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