Data entry user form, copy paste with variation data - excel

I'm working on a user form in excel vba. The purpose of the user form is to make data entry more efficient. The data that is being entered is for shoe products. Basically a "parent" of the data is made in one row. The proceeding rows, or what I refer to as children/variations, have the exact same data except certain fields(columns) will be variations of the parent and each variation will have a unique identifier.
For example: say we're entering data for "shoe123". The parent data would be like this
Title Sku
Shoe123 S123
Then the children would be in the row underneath with the same data except the variation size will be tagged at the end of some fields as well as a unique identifier for each variation. Theyd look something like this.
Title Sku
Shoe123 10.5 s123 10.5
Shoe123 11 s123 11
Uniqueid
09876543311
09876543321
So at this point I have been able to enter all the parent data in the form and transfer it to the appropriate column. I'm trying to figure out two things.
How can I code the user form to allow the user to enter the number of variations to create? and then based on the number the user enters, populate that number of combo boxes with pre filled size selections with text boxes next to each combo box to enter the unique identifier?
How would I copy and paste all the parent data with the variation data for each size selected as well as the unique identifier for each variation?
so far I'm thinking I'll need to use arrays for the copy and paste part. I just need some direction. Any help is greatly appreciated!
Thanks Everyone

I understand from your question that you are trying to create a database. If this is correct I would advice you to try and create this in Access. In Access it is a lot easier to link parent data to children. It will also safe you all the time you would need in Excel to code the userforms, etc. as this is (almost) use-ready provided in Access.
If you are determined to create this in Excel, perhaps you could show the vba-code you have so far?

Related

Excel Single Use Dropdownlist

My problem is the following.
I have two tables.
The first table is a guest list where the information on who is the guest and how many beds he need is stored. Screenshot
And the second table contains the Apartment names and the number of provided beds.
Now I want to make a dropdown list in the guest list table where only Beds are shown that provide the right amount of beds. And after a Apartment is selected it cant be picked a second time.
Can someone provide me a code for this solution?
Thank you very much!
There is functionality in Excel to use Dropdowns, to do this you need to identify your drop down requirements as shown below. Only include items the dropdown list if these not going to change.
I recommend to create a new tab in your excel workbook for list, then you can reference this in cell you want -https://support.microsoft.com/en-us/office/video-create-and-manage-drop-down-lists-28db87b6-725f-49d7-9b29-ab4bc56cefc2
Dropdown list
Guest 1
Guest 2
Guest 3
Assumptions:
Sound like you need know if bed a is available based off guest drop down list. If bed is available or not it can't be selected again.
I will let you attempt this but you can try and use IF Statement or VLOOKUP.

Double-column DropList / ComboBox in Excel cell without VBA or Form?

Is there a way in Excel to create DropLists that display 2 columns intead of 1?
I know this can be done in VBA via a Form, but I do not want this file to be macro-enabled and even less to have to resort to a Form; I want the list to be in a cell and to have a whole column with these lists (like a column-wide Data Validation).
Assuming this is impossible, here's the workaround I implemented: I created a third column being a join/concat of the other two, so that my DropList shows both column info at the same time.
The small drawback is that when processing the selected value, I need to get only the part I need.
For instance, if my columns are "ID" and "Name", I display "Name [ID]" in the list, and when I retrieve the selected list value to process it in a formula, I get the text between [square brackets] so that I can use the unique identifier while allowing the user to choose a meaningful name in the list instead of an ID they know nothing about.

How can I reference a dynamically created control in VBA?

I've been finding the answers I need here on StackOverflow for months (thank you all!) but so far my search terms aren't finding the result I need this time... hence, my first post here...
I have an Excel file that includes two UserForms:
The first is used to input certain invoice data and then export that data in a format that can be uploaded into our proprietary accounting system.
The second is later used to post payment data against those invoices and then, similarly, export that data in a format that can be uploaded into our accounting system.
The second form has to be created dynamically in Userform_Initialize, because the number of payments required (and, thus, the number of TextBox and Label controls created) varies depending on the size of the invoices. I've finished the code to create this second form and it works well, but I'd like to add some functionality that is triggered when some of these dynamically created controls are changed by the user.
I've done this in other forms using a given control's _Change() procedure (for example, when I want to move to the next box after entering a dollar amount, I use _Change() to SetFocus elsewhere as soon as the value has two digits after the decimal). So my question is: how can I establish _Change()-style procedures for controls that don't yet exist before the form is initialized? Is there a way to set a "global" _Change() procedure that I can use to loop through text boxes and use if/then/else statements based on their dynamic names?
Any tips would be greatly appreciated!
When I am using dynamic forms, I like to create object arrays to store the relevant information so that I can quickly and easily reference the objects by "name".

Using VBA with Checkboxes and vLOOKUP?

I'm trying to make a small info sheet that has a drop down menu with a bunch of names. When you pick a name it automatically fills out a bunch of info on them. I also want it to have a checkbox that is checked if that person has a job. The problem I'm having calling/saving that value.
I'm trying to make it so all the saved information is on a second hidden sheet. Calling the information is easy enough. But changing it and having it save over what was previously there seems really hard.
Well, in the hidden sheet you should reserve one column with all the names and another column with two values that tells wether the person has a job or not, so say either 1/0 or Y/N.
The checkbox click/change event is what causes the column with the Y/N values to change. So I would just simply change the relevant value in the column that has al the Y/N values.

Filling rows of a repeating table on opening the form

In my Infopath form I use a repeating table. On opening this form on sharepoint I would like to have some rows of the repeating table filled out using information from an other list. I use content types.
What i am working on is a Timesheet system where the user can register how many hours a week he worked on different projects.
I would like that by creation of a timesheet some predefined projects will be already inserted, meaning that the repeating table will have for example 5 rows already with 5 favourite or most used projects selected based on a separate PetProject list.
When I looked at the workflow in the list where the timesheet is being created I couldn’t find the column projectname in the dropdown so I cant give it a value. When I went to look in the Form settings of TimeSheets I saw that projectname cant be selected/edited, its in plain black whereas the other columns are blue and clickable. I thought its probably because the value of projectname is merged from the different rows in the repeating table.
Is there any way I can work around this problem and assign a value to projectname by creation of the timesheet?
Thank you so much!
I think that you will need to write some code to query the data that you are after and add the data to new rows in the repeating table.
There is a loading event that you can hook into to then query a secondary data source and then
add the row to the repeating table.
Will this run with in infopath as a thick client or will it run as a browser based form using infopath form service?

Resources