Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My coworker wants to create an invoice template in Excel 2007. In column 1, he wants to be able to put in a SKU like '000293954'[1], and when he hits tab, have the other columns fill in a matching description and price. There would be a bunch of different SKUs and information.

Has anybody done this type of thing with a macro before? Any advice?

(I have programming experience with Javascript, PHP, and Ruby, but have never written a macro.)

[1] The input wouldn't be typed - he'd use a wedge barcode scanner that inputs just like it was typed. Not that it matters for this question.

share|improve this question
up vote 4 down vote accepted

Where's your list of products? In another Excel sheet? If so, the best course would be using VLOOKUP to get the information. Say you enter SKUs in A10:A20. You could get the product name in B10 like

=IFERROR(VLOOKUP(A10,ProductList!A1:G1000,2,FALSE),"Product Not Found")

I've made a lot of assumptions here. Your products are on a sheet in the same workbook named ProductList. The products on ProductList are in A1:G1000 (a named range would be better).

share|improve this answer
Great! This does the trick. (I got a bit of help from here, too: – Nathan Long May 3 '10 at 19:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .