MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Perform a function based on a VLookup

  Asked By: Molly    Date: Dec 17    Category: MS Office    Views: 1701

I am struggling on how to get started writing a macro. Here is what I
want to do:

1. The user inputs a SKU and lot/batch number
2. Based on the SKU, there is a VLookup to determine the supplier
3. Based on the supplier, a specific function is applied to the
lot/batch number that extracts the date of manufacture

I have the function written to extract the date of manufacture, but my
problem is getting excel to perform the funtions specific to a
supplier. (Each supplier's lot/batch numbers are slightly different.)

Any ideas on how I make the connection between supplier and specific



1 Answer Found

Answer #1    Answered By: Yvonne Watkins     Answered On: Dec 17

there's LOTS of ways of doing this!
the question is, how do YOU want to do it.
How are you entering the SKU number?
What are you doing with the results?
Why not use a button on the sheet to open
an input box for the user  to enter the SKU.
Then, pass this SKU to your function.
Have your function  do the VLookup
(you can use Application.Worksheetfunction.VLookup
or code a search loop to look it up)
then use this info for your existing function.
When you're done, you can put the results in
the cells of the sheet.
Or... you can create a Change Event for the sheet
that fires off the function that would read
the SKU and supplier from the sheet.
If you need help (or more info) with either approach,
let me know...

Didn't find what you were looking for? Find more on Perform a function based on a VLookup Or get search suggestion and latest updates.