+ Reply to Thread
Results 1 to 4 of 4

automate Vlookup and Autofilter

  1. #1
    Registered User
    Join Date
    06-13-2010
    Location
    New Brunswick, New Jersey
    MS-Off Ver
    Excel 2007
    Posts
    2

    automate Vlookup and Autofilter

    Hello - I am well versed with formulas but still a begginer with VBA so bear with me.

    I am trying to write a Macro that performs a Vlookup using a value in Sheet1 against an array in Sheet 2.
    There are three columns in sheet 1 - ProductCode, CodeFamily, CurrentInventory
    I want the value of the function to drop the new inventory number (off the array in Sheet 2) in new Column D
    Then after it returns that value I want in to autmatcally filter the differences between CurrentInventory (column C) and UpdatedInventory (column D)

    Here is where I got so far - I am stuck on the Loop function and haven't performed an autofilter yet...
    Please Login or Register  to view this content.
    Last edited by royUK; 06-13-2010 at 09:43 AM. Reason: add code tags,edit title

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    re: automate Vlookup and Autofilter

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here

    Edited this time,be sure to read the Forum Rules
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: automate Vlookup and Autofilter

    I wouldn't use a Loop,that will be inefficient.

    Explain exactly what you need to do & add an example workbook

    Don't put error trapping in your code until it is working, if you do you won't get error messages so won't be aware of them

    You don't need toselect the ranges

  4. #4
    Registered User
    Join Date
    06-13-2010
    Location
    New Brunswick, New Jersey
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: automate Vlookup and Autofilter

    Thanks for the help...I need to read up on more fundamentals of VBA programming as I am all over the place

    Here's exactly what I need. In the sample work book I have these columns:

    Sheet1

    A CurrentCode
    B OldInv
    C UpdatedInv

    Sheet2

    A Code
    B Inv



    Sheet1 has old inventory codes and numbers and Sheet2 has the updated information

    Column A on Sheet1 and 2 have the same values

    I want to put the new inventory values for each code in Column A (Sheet1) in Column C (Sheet 1) =VLOOKUP(A2,Sheet2!$A:$B,2,0)

    Than after the values are added to Column C (Sheet1) I want to auto filter where there is a different value in Column B (Sheet1) and Column C (Sheet1)

    Please help! Thank you!
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1