• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Syncing two userforms in excel worksheet (Vlookup?)

AndrewGKenneth

New Member
Hi there,
Could anyone help me please? I have created two working user forms and need to get them to sync in the worksheet. (Userform1) will be used to enter data at the start of the working day and the second user form (Userform2) will be used to complete the data at the end of the working day.

Userform1 will populate the following columns on the worksheet: 1,2,4,5,6,7,8,9
And Userform2 columns: 3,10,11,12

Both userforms will have a job number for the user to input that can link the user forms. However, the problem I am having is that there will not only be one job number being worked on each day.

For example, Job Number – J124021 starts at 11pm and the user will fill in Userform1 to let us know this has started.
A different job, Job Number – J172831 then finishes at 8pm that day so the user will fill in Userform2 to let us know this job has finished for the day. The problem is that when this information is completed it is currently going into the next available blank columns 3,10,11 and 12 – which in this case would be next to the previous data inputted from userform1 (first job – job number J124021) and therefore would be the wrong information.

Therefore, what I need to do is create a code in userform2 (I imagine using the vlookup function) to recognize the same job number in column 1 of the worksheet (as both userforms can be linked by job numbers) and only complete columns 3,10,11,12 if the job number in column 1 matches. I Imagine this would be using the Command Button add.

For your information the relevant textboxes are labelled as follows:
Userform 2 – Data to be inputted into Column 3 – TextBox_End
Data to be inputted into Column 10 – TextBox_FG
Data to be inputted into Column 11 – TextBox_NG
Data to be inputted into Column 12 – TextBox_MAT_NG
The vlookup will be looking in Column A of Sheet1 (i.e. Job Number) and this is TextBox_JobNumber in both userforms.

Please let me know if you need any more info and if anyone can provide me with code to perform this function I would be very grateful. I should also mention that there will be multiple entries for each job number, so the code will need to find the latest matching job number and only fill the columns if the values are blank in columns 3,10,11 and 12.
Thanks so much!
Andrew
 
Back
Top