MACRO Help

D

DNA

I have several worksheets in a workbook. Each sheet has a column "Part
Number" (in different locations throughout each sheet).

I also have another column "Employee" (which is a number value).

Here's the task: If a part number is 5400 (for example) make the employee
number column 001. Overall, if part number is X, then employee number
automatically pre-fills with an employee number.

Hope this make sense.
 
S

SteveG

Assuming that each Part Number has a unique Employee id then you don'
need to use a macro if you don't want. Create a table with Part Numbe
in column J and corresponding Employee in K. Sort in ascending order b
Part Number.

In your sheet, say your Part Number is input in column A and th
Employee number you want to automatically fill is in column B. In B2.

=VLOOKUP(A2,$J$1:$K$6,2,FALSE)

This looks up the Part Number in A2 and compares it to the table yo
created and returns the corresponding Employee number from that table.
For asthetic purposes, hide the columns containing your tables if yo
don't want them to be seen. You could also create the table in
separate worksheet altogether and hide that from view as well. I
order to see the preceding zeros in your results (Employee Id = 001
format your cells as> 000.



Cheers,

Stev
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top