Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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: techonthenet.com/excel/formulas/vlookup.php) –  Nathan Long May 3 '10 at 19:54

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.