+ Reply to Thread
Results 1 to 24 of 24

I need to create a form that will export to a spreadsheet.

  1. #1
    Registered User
    Join Date
    10-02-2022
    Location
    Tucson
    MS-Off Ver
    Varies
    Posts
    13

    Exclamation I need to create a form that will export to a spreadsheet.

    I am trying to create a front-end form that can be filled out by a user, which will then populate a back-end spreadsheet the user cannot edit. This spreadsheet needs to follow a standard layout that I have already created, and the form will populate predetermined cells (or will create cells following the layout) based on user input from the form. I also need the form to be able to add/repeat questions, as well as duplicate sections in the spreadsheet based on user input requirements ("Do you need to add a section? [Yes/No]" //If [Yes], then duplicate section, repeat questions in form; if [No], then export data to spreadsheet, exit form). The spreadsheet layout consists of sections. The number of sections/cells per section required will vary from user to user, but the type of data will typically remain the same, and therefore should be able to choose the name of the field from a list of some sort (drop down?) However, the user may need to create a custom name for a field. I also need the form to be able to automatically adjust cell sizes based on the amount of text for that value. It is important that this form is printable, and does not separate sections from page to page. Furthermore, each "Notes" field will vary in size, and should be automatically resized to only show the existing text, plus one blank line for hand-written notes. I would also like the form to prompt the user to indicate whether a field is needed (some fields will be permanent, and the user will not be prompted about these fields). If the field is not needed, I need the form to exclude it from the final output.


    Spreadsheet screenshot first page.png

    The image contains the basic premise of the final layout for the data. In the red bracket (forgive my terrible drawing), you will see three sections. Each section is its own entity, but contains the same type of data. Users will typically only need these fields, but may need additional fields depending on their project. If the user needs additional sections, the form should duplicate one section at a time. The top section that is not outlined by the bracket will not need to be duplicated, and will only ever exist on the first page of the spreadsheet.

    Please note: I am not asking for anyone to do the work for me. I just don't know where to start, or even if this is feasible in Excel. I am willing to use VBA, but bear with me as I haven't used VB in nearly 20 years.

    Thanks for all your help.
    Last edited by auglocqnuk; 10-02-2022 at 06:47 PM.

  2. #2
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,302

    Re: I need to create a form that will export to a spreadsheet.

    upload a workbook - see big yellow banner for instructions - show 10-20 rows of data stored as you envisage it.
    what you appear to be wanting to create is a 'pseudo' database - the layout shown is not a compatible format for storage - the layout resembles a report format which you would generate from your data.
    you use the word 'form' are you envisaging creating this on the sheet or utilising a VBA UserForm for data input. ?
    Torachan,

    Mission statement; Promote the use of Tables, Outlaw the use of 'merged cells' and 'RowSource'.

  3. #3
    Registered User
    Join Date
    10-02-2022
    Location
    Tucson
    MS-Off Ver
    Varies
    Posts
    13

    Re: I need to create a form that will export to a spreadsheet.

    You are correct, torachan: I would like to generate a report format from the data users input. As for the form, I do not want users to see the spreadsheet itself, only the output/final report from their input, so I suppose I would be using a VBA UserForm. I don't much care what the spreadsheet containing the data fields looks like The final report, however, must follow the layout I have given in order to facilitate readability. Ideally, the final report would be output into a PDF.
    Last edited by auglocqnuk; 10-10-2022 at 01:15 AM.

  4. #4
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,302

    Re: I need to create a form that will export to a spreadsheet.

    interesting project - not a 5 minute solution - check back in a couple of days should have draft together by then.

  5. #5
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,148

    Re: I need to create a form that will export to a spreadsheet.

    I suspect much of the data can be determined from drop-down lists so can you provide the data

    e.g. Material, Tool Name, Tool Type, Tool Size ......

    and can you provide idea(s) of how the Userform should look as the output is quite complex.
    Last edited by JohnTopley; 10-03-2022 at 10:01 AM.
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  6. #6
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,302

    Re: I need to create a form that will export to a spreadsheet.

    @auglocqnuk, the attached is a suggested approach - to enter data first 'CLEAR' the form - this will give you a sterile form and enable the 'ADD' button - fill your header data plus machine data - press 'ADD' - you will be asked if you want to enter another machine item 'YES' will leave the header data in place (just then fill the machine data, again press 'ADD') - if you answer 'NO' the line will be saved and the form will clear.
    To update or delete select via the combobox then the listbox and modify your date and press 'UPDATE' or just press 'DELETE' to remove from sheet.
    To print just use the combobox (only interested in recovering the drawing # - the listbox will fill with all machine ops related to drawing # - do not select from listbox, just press 'PRINT' - a PDF should find your desktop.
    This all will need fine tuning, it is only presented as a concept, the PDF format will need 'page breaking' sorting as the header is a different size to the operation boxes so more code needed to control presentation.
    p.s. form made to cover all items of data - put 'none' or just a comma in textboxes that are not applicable - there has to be some character in textbox to enable a save.
    @John's comments regarding combobox selection would give you an added feature well worth considering to aid data entry consistency.
    Attached Files Attached Files
    Last edited by torachan; 10-05-2022 at 06:20 PM.

  7. #7
    Registered User
    Join Date
    10-02-2022
    Location
    Tucson
    MS-Off Ver
    Varies
    Posts
    13

    Re: I need to create a form that will export to a spreadsheet.

    torachan, this is an excellent starting point, thank you very much. There are a few bugs/issues I need to work out, as well as some data points I need to add in, but this is quite close to the end result I was hoping to achieve. My VBA skills are rusty at best right now, so if I have any questions I'll be sure to ask. Thanks again!

  8. #8
    Registered User
    Join Date
    10-02-2022
    Location
    Tucson
    MS-Off Ver
    Varies
    Posts
    13

    Re: I need to create a form that will export to a spreadsheet.

    JohnTopley, Thank you for your suggestion. The drop-down lists will definitely be a useful means of limiting end-user mistakes. torachan uploaded a starting point that is quite close to my desired end result. Please feel free to take a look at it and let me know if you have any suggestions. I will keep this thread open a bit longer just in case, but I am quite please thus far.

  9. #9
    Registered User
    Join Date
    10-02-2022
    Location
    Tucson
    MS-Off Ver
    Varies
    Posts
    13

    Re: I need to create a form that will export to a spreadsheet.

    I broke it! What did I get wrong/miss? Setups.xlsm is the "before" version, Setups error.xlsm is the "after" version. Thanks for the help!
    Last edited by auglocqnuk; 10-10-2022 at 01:16 AM.

  10. #10
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,302

    Re: I need to create a form that will export to a spreadsheet.

    nothing too drastic - the only thing I have corrected is the positioning of (cells data) in the 'Print' sub - you had not got the offsetting correct.
    Try the attached, I will leave the 'page break' coding until a final layout format is decided.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    10-02-2022
    Location
    Tucson
    MS-Off Ver
    Varies
    Posts
    13

    Re: I need to create a form that will export to a spreadsheet.

    That's awesome! My next issue, which I forgot to mention before, is that users will be submitting data chronologically, but the print function outputs the data in reverse order from chronological input. Essentially, I need the entries printed in sequential tool order. How do I do that?

  12. #12
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,302

    Re: I need to create a form that will export to a spreadsheet.

    Not quite sure I understand, there is no date input, or do you mean print everything just in reverse order, can you upload a file with a couple of examples,

  13. #13
    Registered User
    Join Date
    10-02-2022
    Location
    Tucson
    MS-Off Ver
    Varies
    Posts
    13

    Re: I need to create a form that will export to a spreadsheet.

    Hi torachan. I've been ill, so I haven't been working until today. I've managed to make some headway. In relation to the code, however, I'm slightly lost in some areas. For example, you mentioned (regarding the form I broke), that I had not gotten the offsets correct. I'm doing a side-by-side comparison, and I am a little lost in the area of the offsets. I know this is a big ask, but could you write comments into the code for each line? For the most part, it's fairly straightforward, but in other cases the comments would be of great help. Especially if you could help me link the code visually to the form function (I work really well with visual references). Take the code for the print button, for example:

    Please Login or Register  to view this content.
    I'm not sure how the highlighted parts work. How do the variables work? How do they relate between the form and the cells in the spreadsheet?

    I'm not sure if my question is coherent enough to follow (I'm still a bit fuzzy from my illness), but comments in the code itself would really be of great value to me as I relearn to code.

    Thanks so much!
    Last edited by auglocqnuk; 10-09-2022 at 10:25 PM.

  14. #14
    Registered User
    Join Date
    10-02-2022
    Location
    Tucson
    MS-Off Ver
    Varies
    Posts
    13

    Re: I need to create a form that will export to a spreadsheet.

    Hi torachan, I have made some additional adjustments. Primarily, I've added an image box for a reference photo for each tool. In the user form, the user is able to select whichever image they want via a file selection dialog. However, after searching online, I have come to a roadblock regarding saving said image to the tool data in worksheet 2. Additionally, I need each tool's respective image printed to the exported PDF.

    As for the exported PDF, after updating a tool, the PDF is no longer in sequential order; the sequence of the tools listed on the PDF should be in order. For example, Tool 1; Tool 2; Tool 3; Tool 4; et cetera. I'll upload a copy of a PDF that is exported in non-sequential order. Please note, however, this only happens if I have updated a tool.

    I have also noted that the tool section is precisely large enough to fit 3 per page in landscape orientation after the first page (page 1 perfectly fits the header section and two tools). Can we add a page break to resolve the presentation after page 1?

    I'm slowly re-learning how to do all this coding stuff, but it is a great deal of fun for me.

    Thanks so much for your help!
    Attached Files Attached Files

  15. #15
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,302

    Re: I need to create a form that will export to a spreadsheet.

    i will look at this tomorrow as today is very busy for an 'old guy'.

  16. #16
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,302

    Re: I need to create a form that will export to a spreadsheet.

    Give the attached a try, I have resorted back to my original (rather than sorting out your mods) just to get the PDF to landscape and the addition of incorporating a picture.
    Place your .jpgs in an easy to access folder - the selection of your picture should put the file path in the adjacent textbox (this textbox is not manually editable) the path will be saved to the sheet and can be altered using the update routine.
    The reason previously that tools were out of sequence was the addition of extra columns - the last column is reserved for the row counter - this must always be the last column and its referencing within the code altered accordingly if you add columns.
    Attached Files Attached Files

  17. #17
    Registered User
    Join Date
    10-02-2022
    Location
    Tucson
    MS-Off Ver
    Varies
    Posts
    13

    Re: I need to create a form that will export to a spreadsheet.

    Hi tora, the filter is still allowing the exported file to split records between pages, despite being in landscape mode (whose orientation is preferred, anyway). Additionally, the export code is placing the data from "Project Notes" into both the "Setup Sheet Rev" and "Project Notes" fields in the exported file. I noticed, however, that Sheet2 does have the correct information in the correct places. Also, if you could clue me in as to how the code works for the rotation fields (in the form, the input is "Q" or "P", and the PDF shows clockwise or counter-clockwise symbols), I would be greatly appreciative. My work has kept me away from the computer this week, so I have not had any time to work on this project (which is far more interesting to me than my actual job). I will be off tomorrow (Sunday), however, so I will put in the time then. In the meantime, if you have a chance, please let me know if you have a solution.

    Thanks so much,

    Auglocqnuk

  18. #18
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,302

    Re: I need to create a form that will export to a spreadsheet.

    upload your file that is showing fault as the one I uploaded is OK at my end - the 'P' & 'Q' are the Wingdings3 defaults for the rotation symbols - probably better if you select from a combobox.
    my copy put the correct notes in the in the fields you mention
    my apologises, I see what you mean (did not see that initially as all enteries were just 'Test'.
    alter the last number of third row in this part of the print routine from an eight to a seven (this just controls the vertical offsetting)

    change
    Please Login or Register  to view this content.
    to

    Please Login or Register  to view this content.
    Last edited by torachan; 10-15-2022 at 05:49 PM.

  19. #19
    Registered User
    Join Date
    10-02-2022
    Location
    Tucson
    MS-Off Ver
    Varies
    Posts
    13

    Re: I need to create a form that will export to a spreadsheet.

    Cool, so that edit worked, but the page layout is still broken. I haven't changed any code other than what you already provided for the fix to the text fields. I've found that there's a VBA function for page breaks. However, when trying to implement it in the print command, the code doesn't change anything. I'm guessing I need to place a version of this function in the filter somewhere, but I'm not sure how/where?

    Please Login or Register  to view this content.
    B

    I could also use a "Cancel Add" button. I can add the button easily, but I'm not sure how to actually code it. If I'm not mistaken, that would involve removing a row that contains null fields, which are currently not allowed. I could remove that if statement, but that would still leave me with an entry that I then need to find and delete.

    Currently, all data relating to a part/tool is listed when selecting a part in the Print and Search Facility. Can I limit that data to only the part number and tool data, or even list the tool number in the first column?

    Finally, in testing the form on different computers, I've found that it's set size is a bit cumbersome on some screens (especially laptops). I've tried to add code to be able to resize the window, but I can't get it to work properly, so I end up removing the code and starting over.

    I'm reading "Mastering VBA 2019 For Microsoft Office 365 2019 Edition" in my spare time, but as it turns out I don't really have much of that these days.

    I can't thank you enough for all the aid you've provided me.
    Last edited by auglocqnuk; 10-16-2022 at 10:42 PM.

  20. #20
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,302

    Re: I need to create a form that will export to a spreadsheet.

    I will look at page break and possibility of printing individual/selected parts (each will influence the other).

  21. #21
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,302

    Re: I need to create a form that will export to a spreadsheet.

    started to look at 'broken page' layout - first question I should have asked - if you are printing out to paper, what size paper are you using (as we universally use A4, which I believe is not used in USA)

  22. #22
    Registered User
    Join Date
    10-02-2022
    Location
    Tucson
    MS-Off Ver
    Varies
    Posts
    13

    Re: I need to create a form that will export to a spreadsheet.

    Oh, excellent point. I didn't think about this. We use 8.5 by 11 inch paper.

  23. #23
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,302

    Re: I need to create a form that will export to a spreadsheet.

    in this block of code add the two separate extra lines that alter the row height - then see if by adjusting the size you can span the page break of your particular paper size.

    Please Login or Register  to view this content.

  24. #24
    Registered User
    Join Date
    10-02-2022
    Location
    Tucson
    MS-Off Ver
    Varies
    Posts
    13

    Re: I need to create a form that will export to a spreadsheet.

    Thanks, torachan. I tried this edit, but it didn't help. I fiddled with all kinds of different sizes, but nothing changed visibly. I'm going to try starting with a new file, and working my way up from scratch. Perhaps something in the file's settings got jumbled somehow. Anyway, thanks for the help so far, and I'll let you know how the new file works out.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Create excel form that updates different spreadsheet
    By rafcaf in forum Excel General
    Replies: 2
    Last Post: 09-15-2018, 04:50 PM
  2. [SOLVED] Create a form for viewing only as PDF from an Excel spreadsheet
    By cinstanl in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-14-2016, 03:39 PM
  3. Export data from excel spreadsheet to create packing slip
    By roxii in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 04-21-2015, 08:37 AM
  4. Macro to Export Data from one spreadsheet to a Report Spreadsheet
    By stockgoblin42 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-11-2013, 03:59 PM
  5. Replies: 0
    Last Post: 11-26-2007, 09:22 PM
  6. [SOLVED] How do I create a 1pg form for each row of data in a spreadsheet?
    By khoffmann64 in forum Excel General
    Replies: 0
    Last Post: 04-20-2006, 03:50 PM
  7. Replies: 2
    Last Post: 03-29-2005, 05:06 AM

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