+ Reply to Thread
Results 1 to 2 of 2

Adding a vlookup into VBA command button ?

  1. #1
    Registered User
    Join Date
    03-07-2014
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    10

    Adding a vlookup into VBA command button ?

    I was wondering if it would be possible for me to work a vLookup function into my VBA code for my command button to where after it pastes the appropriate information in the cell it performs a vLookup to find the price of said item and adds it into a cell across from the selection.

    To try and explain better I have a listbox in a userform that contains three columns. The Name,Description, and Price respectively (However I can only seem to get it to paste on selection, so a work around of that would be very welcome instead) When I click the button it takes the Description selection of the CMD Box and puts it in the active cell (I need to be able to place it active cell due to the unpredictable placement needs) however I also need to have the price across the page from it so I was wondering if there would be a way to incorporate vlookup so that it would figure the price that way or if I should just scrap this idea and rethink of how to go about it.

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Adding a vlookup into VBA command button ?

    Hi, you can use vlookup in vba like this:
    Please Login or Register  to view this content.
    it works the same as the worksheet formula but you need to put the references in Range("A1") format not just B1:D2000

+ 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. Adding code to the end of a command button.
    By jharaldson in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-07-2012, 03:34 PM
  2. [SOLVED] Adding a command button to the menu
    By stojko89 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-13-2012, 01:29 AM
  3. Need help with adding Command button
    By lynhall in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-20-2008, 03:03 PM
  4. Adding a new sheet with command button
    By crapmind in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 08-13-2007, 04:05 AM
  5. Adding A Date Command Button
    By hazey in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-12-2005, 05:55 PM

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