Closed Thread
Results 1 to 3 of 3

Copy data from one worksheet to another, and create new worksheets for each data set

Hybrid View

  1. #1
    Registered User
    Join Date
    05-27-2010
    Location
    Oklahoma
    MS-Off Ver
    Excel 2003
    Posts
    1

    Talking Copy data from one worksheet to another, and create new worksheets for each data set

    I have two worksheets in one workbook... The worksheet 'data' contains some data that I need to copy and paste into certain cells in another worksheet called 'form'. for each row of data I need a new worksheet created from the 'form' worksheet.

    Basically for each row of data in my 'data' worksheet (321 rows) I need a new worksheet created from my template worksheet 'form'. the data that I need copied from the 'data' worksheet is in cols B-G, and I need this data pasted into the 'Form' worksheet into cells B4 - G4.
    The names of the new worksheets created doesnt matter, i suppose they just have to be unique.

    Also I would like to fill in the date field which is located in column J in my 'data' worksheet and have this pasted into H8 in my 'form' worksheets.

    Also, the rows of data will change daily, it will not always be 321 rows.

    I'm fairly new to VB... So any help would be GREATLY appreciated!

    btw, I am using office 2k3 on Windows 7.

    I tried using this code to create the new worksheets, it worked but, it only creates 254 new worksheets then errors out.

    Option Explicit
    
    Sub Copy_Sheets()
    
    Dim i As Integer
    Dim wks As Worksheet
    
    Set wks = Sheets("data")
    
    For i = 1 to 360
        Sheets("form").Copy After:=Sheets(2)
        ActiveSheet.Name = wks.Cells(i, 2)
        ActiveSheet.Cells(1, 2)=wks.Cells(i, 2)
    Next
    
    End Sub

    Thanks!!

    -Brad
    Last edited by royUK; 05-28-2010 at 01:24 AM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Copy data from one worksheet to another, and create new worksheets for each data

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here

    I have added the Code Tags. Make sure that you read the Rules before posting again

    I also cannot see any reason for creating 360 sheets. A template sheet using VLOOKUPto populate it from aproperly laid out set of data would be much more efficient
    Last edited by royUK; 05-28-2010 at 01:26 AM.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Copy data from one worksheet to another, and create new worksheets for each data

    Your post does not comply with Rule 8 of our Forum RULES. Cross-posting is when you post the same question in other forums on the web. You'll find people are disinclined to respond to cross-posts because they may be wasting their time solving a problem that has been solved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser)to the cross-post. Expect cross-posts without a link to be closed a message will be posted by the moderator explaining why. We are here to help so help us help you!

    Read the linke about cross-posting in my signature!

Closed Thread

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