0
votes

Super new to coding, please help and please excuse the lack of general knowledge:

Is there a match function equivalent in VBA?

I have a userform that has the following: - a combobox to select employee name - a comboboc to select project number - text box to input hours worked - text box to input OT hours worked

On Sheet2 named "Template for Input" I have a sheet that needs to stay in this format: Project Numbers going accross in starting in Row B11 and Employee Names listed in vertically starting in ColumnA12. Each name is duplicated to allow for RegHrs and OTHrs.

Example:

          Project 1     Project 2   Project 3

Doe, Jane

RegHrs


Doe, Jane
OTHrs


Smith, John
RegHrs


Smith, John
OTHrs

I need my Submit Hours commandbutton in the userform and have the data selected populate the worksheet in the appropriate columns/rows. For instance if entry is Doe, Jane Project 2, 40 RegHrs 6 OT Hrs. How do I write the code so when the click submit it populates Jane's hours in the right spot??

I also would need it to clear the userform so they can input the next employees hours until they are finished and hit close.

I hope that wasn't too confusing. I appreciate all of the help~~~

1

1 Answers

0
votes

so, the code that you will write in your UserForm Submit Hours command button Click event needs to perform the following actions:

  1. Declare variables
  2. Put the values of the Userform fields (textbox, and combo-boxes) in variables.
  3. Find the right project, and the right person name, and determine if it's Regular Hours or O/T Hours
  4. Based on the above, plug in the values
  5. Clear the UserForm fields

you know, you could add Named ranges using the row titles in the Left column, and the column titles above to make it easier.

So, after you have written some code come back to us if you need help

Here are a few other website for your reading:

Best of luck

Philip