+ Reply to Thread
Results 1 to 6 of 6

Vba vlookups

  1. #1
    Registered User
    Join Date
    12-20-2015
    Location
    USA
    MS-Off Ver
    2013
    Posts
    5

    Vba vlookups

    Hello all, I'm wanting to have a system where a user presses a button that opens up a prompt to scan product and if it exists on list B than it copies some data to Sheet 1 A and B. But if it is already on Sheet 1 in A or B to delete it. I have gotten pretty much everything working.

    The thing is I have it so it will add everything using any empty spaces first, and if it is on the list it will also be removed. But the problem is, is I have no idea how to make it do a VLOOKUP to see if that product already exists or not.

    Take for instance I add the following parts

    Glue
    Staples
    High powered rifle

    If I scan Glue again it removes it just fine, but if I scan a high powered rifle it will add it to the first slot despite already being on the list.

    *Note these are not my actual products*

    Some script I already have

    Please Login or Register  to view this content.
    Also please keep in mind I only started learning this about 15-16 hours ago so I'm probably doing everything inefficiently
    Last edited by Kiichiro; 01-08-2016 at 12:44 PM.

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,613

    Re: Vba vlookups

    (How to) Upload a Workbook directly to the Forum
    (please do not post pictures or links to worksheets)
    • Click Advanced (next to quick post),
    • Scroll down until you see "Manage Attachments",
    • Click that then select "add files" (top right corner).
    • Click "Select Files" find your file, click "open" click "upload"
    • Once the upload is completed the file name will appear below the input boxes in this window.
    • Click "Done" at bottom right to close the Attachment Manager.
    • Click "Submit Reply"
    Note: Please do not attach password protected workbooks/worksheets
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    12-20-2015
    Location
    USA
    MS-Off Ver
    2013
    Posts
    5

    Re: Vba vlookups

    Alright my apologies. Attached is my workbook.
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    01-08-2016
    Location
    Cagayan De Oro City, Philippines
    MS-Off Ver
    2013
    Posts
    152

    Re: Vba vlookups

    Hi,

    A lookup is pretty easy to perform, it might be a good idea to remove the blank spaces as well if that wont cause any problems.......

    im going to write this generally so you will have to study it for a few minutes ....

    first the VBA lookup, its super simple and likely faster than any formula

    Please Login or Register  to view this content.
    Hope this helps a little, i really dont recommend using formulas or worksheet functions within VBA, sometimes its convenient but the problems usually outweigh the benefits....


    Thanks
    Paul S.

  5. #5
    Forum Contributor
    Join Date
    01-08-2016
    Location
    Cagayan De Oro City, Philippines
    MS-Off Ver
    2013
    Posts
    152

    Re: Vba vlookups

    OK so after a rather rude private message by someone (utter nonsense really...) i decided to follow up on the code i left to help you and built the whole thing for you.....People may not like my methods but i think sending a different angle to view triggers a better response and better thinking than simply handling you a bunch of workaround fixes which will again lead to more problems.... sorry as a professional developer thats just how it usually goes....

    My previous post would have forced you to rethink how you wrote your code (nothing wrong with it except it wasnt working right so it needed fixing) try and have a look at how i coded this and follow the simple flow of logic..... coding this way will help you troubleshoot problems alot easier.......

    you will need to add some things, for example your sample file only has 3 columns on sheet2, im not sure if you plan on adding more but its easy to do, if you need help just reply



    Thanks
    Paul S.

    PS. your old code is still in there so you can compared and make adjustments

    Working Example.xlsm

  6. #6
    Registered User
    Join Date
    12-20-2015
    Location
    USA
    MS-Off Ver
    2013
    Posts
    5

    Re: Vba vlookups

    Thank you very much! I actually really appreciated the first method, I am looking at the two different codes now however to get a better feel. Like I said, I've only been working with this for a short time.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. IF THEN and VLOOKUPS Together
    By degross77 in forum Excel General
    Replies: 3
    Last Post: 11-20-2014, 05:27 PM
  2. Need help on Vlookups
    By Brian13 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 05-05-2014, 11:50 AM
  3. Excel 2007 : vlookups
    By Cerena in forum Excel General
    Replies: 17
    Last Post: 05-29-2012, 01:02 AM
  4. [SOLVED] Vlookups
    By chris.slater in forum Excel General
    Replies: 1
    Last Post: 03-15-2012, 02:34 PM
  5. Vlookups
    By imageres in forum Excel General
    Replies: 1
    Last Post: 02-09-2011, 05:26 AM
  6. [SOLVED] VLOOKUPS
    By Brett in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-22-2006, 09:55 AM
  7. [SOLVED] vlookups
    By T in forum Excel General
    Replies: 4
    Last Post: 05-13-2006, 07:15 AM

Tags for this Thread

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