+ Reply to Thread
Results 1 to 17 of 17

Populating a form in excel from a different worksheet line by line

  1. #1
    Registered User
    Join Date
    04-17-2012
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    9

    Populating a form in excel from a different worksheet line by line

    Hey all,

    Would really appreciate any help, I'm new to VBA and despite getting off to a shaky start so far so good, but I've been able to solve this problem for a few days now and after much forum searching have been unable to adapt a solution and my deadline is quickly creeping up on me :(

    I'm looking to create a macro that will pull information from a master worksheet (excel) and populate a summary terms of reference template (ToR) in the same workbook but each form (line of data) creating a separate worksheet named by the title column from the master sheet.

    The original data is input to the master via a similar but more in-depth excel sheet, the form/worksheet template needing to be filled out is a simplified version for a high level summary. Therefore only specific cell references are need from the master (not entire the line, but I spose a table could be created fairly easily if this were to be a problem). For example a1 will need to populate b6. There are approx 20 cells of data to populate.

    So far I have managed to find and adapt a code that opens a new worksheet, via the means of a unique list, of which each line names the title column.


    So I guess my question is can there be a way of working the code mentioned above to open a template and take specific cell refs and populate them into the relevant space provided in the template?

    *holds breath* :)

    Laura

  2. #2
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Populating a form in excel from a different worksheet line by line

    Could you provide a sample of you worksheet? It might make it a little easier to understand.

    Thanks!

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,313

    Re: Populating a form in excel from a different worksheet line by line

    What would be good would be a sample workbook showing the raw data and how you would wish it to end up ... and why it should be that way.

    If it's just a case of processing all the cells in the left hand column, creating new sheets from them and populating the cells from data on the same row as the "sheet name/title", it should be fairly straightforward.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Registered User
    Join Date
    04-17-2012
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Populating a form in excel from a different worksheet line by line

    Thanks.

    I've attached a sample spreadsheet.

    To cut out the waffle:

    I need the workbook to:
    Populate the template in a new worksheet with the data in the Master Sheet, and create a new worksheet named by the title cell on a line by line basis.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    04-17-2012
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Populating a form in excel from a different worksheet line by line

    wrong version updated - heres a better(ish) one
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    04-17-2012
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Populating a form in excel from a different worksheet line by line

    Would it also be good to upload the current code I've got?

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,313

    Re: Populating a form in excel from a different worksheet line by line

    If you've got code, I think you shoul share it.

    Thanks for the updated sample ... I would have been asking for that.

    Regards, TMS

  8. #8
    Registered User
    Join Date
    04-17-2012
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Populating a form in excel from a different worksheet line by line

    Please Login or Register  to view this content.
    Last edited by GhettoNarnia; 06-01-2012 at 07:36 AM. Reason: code tags

  9. #9
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,313

    Re: Populating a form in excel from a different worksheet line by line

    OK, you need to add code tags to your code excerpt.

    You've done most of the work ... indeed, more than I knew would be required as you're doing a filter.

    You've got the loop to create the worksheets and you've named the target sheets. So all you have to do is copy the cells to the appropriate destination.

    Please Login or Register  to view this content.
    I can't put the proper code together at the moment as I'm away from my desk and using an iPad. But it shouldn't take much to do.

    Let me know if you need help with it but it won't be until tomorrow night.


    Regards, TMS

  10. #10
    Registered User
    Join Date
    04-17-2012
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Populating a form in excel from a different worksheet line by line

    Thank you so much for your help.

    where would I nest the code above that the issue iv'e been having..

    also code tags? this may be very naive of me but have a missed out something fundamenmtal here?

  11. #11
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,293

    Re: Populating a form in excel from a different worksheet line by line

    if you place [ code] at the at the start of your code and [ /code] at the end, it will display in such a way as to make it easier to read. Edit your post with the code in it with them tags and see the difference

    important = remove the space inside the start of the bracket when you use them

  12. #12
    Registered User
    Join Date
    04-17-2012
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Populating a form in excel from a different worksheet line by line

    thank Nigelog - for a moment there I thought id messed up the code itself - thanks for the info

  13. #13
    Registered User
    Join Date
    04-17-2012
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Populating a form in excel from a different worksheet line by line

    Ok so I've worked on a much better example with the exisiting code included (button on the Form Table) as my noobity is coming through

    So the Master Data will be copy and paste into the blank sheet "Master". The "Form Table" sheet will have Vlookups pulling the information needed from the master.

    I need the current code to be adapted to open the "Template" sheet when creating the new sheets and then pull the information from the "Form Table" into each template created (one line of data = one template).

    Attached Files Attached Files

  14. #14
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,313

    Re: Populating a form in excel from a different worksheet line by line

    Thanks for the updated sample workbook. I know how I would/will approach this but I just need to clarify a couple of points first.

    Are the titles on the Form Table sheet unique? If they are, what is the purpose of filtering them to a separate sheet? Is the UniqueList required for any other purpose than creating the ToR sheets?

    Please note that, to comply with the forum rules, I cannot post a solution until you edit Post #8 and add code tags. I am happy to work on a solution but I cannot upload it until you amend the post.


    3. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Select your code and click the [#] button at the top of the post window (if you are editing an existing post, press Go Advanced to see the [#] button). The result will appear like this in the post window:

    Please Login or Register  to view this content.

    You can also type the code tags in manually if you prefer.

  15. #15
    Registered User
    Join Date
    04-17-2012
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Populating a form in excel from a different worksheet line by line

    apologies for the delay ive been out of office

    no there is no specific need for the unique list I just thought it necessary. Any help would be mucho apreciated

  16. #16
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,313

    Re: Populating a form in excel from a different worksheet line by line

    OK, in the absence of any input, I haven't looked at this at all. I will need to refresh my memory but I'm going to be away for a few days so I won't be able to do anything until next week. I'll pick it up when I get back if you still need a solution.

    Regards, TMS

  17. #17
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,313

    Re: Populating a form in excel from a different worksheet line by line

    The code:

    Please Login or Register  to view this content.

    See the attached workbook. It has not been "destruction tested" as I don't know what other constraints there might be. But ... it copies, names and populates the template sheet, as you have suggested. Note that it relies on the destination cells being listed in row 2 of the Form Table worksheet (rather than split across rows 2 and 3 as in the original)

    Enjoy.

    TMS
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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