+ Reply to Thread
Results 1 to 4 of 4

vlookup on vba

  1. #1
    Forum Contributor
    Join Date
    12-14-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    106

    vlookup on vba

    hi. Pulling my hairout here. I know how to do a standard vba lookup but am trying to get a vlookup working based on value of textboxes and listboxes and defined ranges.

    Please Login or Register  to view this content.
    variety lst part is firing correctly, it seems to register the correct worksheet based on the categorylst selection made in the userform. My issue seems to be how to reference a named range. I have 4 clematisgen, climbergen, evergreengen and fuchsiagen.

    these ranges are all defined on initialisation. I cannot seem to find a way to refer to these ranges using the selection in my category lst and adding "gen" to the end of it.

    Any thoughts massively appreciated. Just cant see why it is not working.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,091

    Re: vlookup on vba

    You've used:

    Me.VarietyLst.Value,
    Me.CategoryLst.Text and
    Me.CategoryLst

    There seems to be a certain inconsistency about the way you are addressing the values of the controls. Don't know if that makes a difference. Can't test it.


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor
    Join Date
    12-14-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    106

    Re: vlookup on vba

    Hi thanks for your suggestion. I tried changing all to .value .text or neither and it fired on first attempt then on second attempt failed again.

    I know I could just write an if function for each category to do the lookup but I rally wated to make my code as dynamic as possible. Again any thoughts would be appreciated

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,091

    Re: vlookup on vba

    There's not much to go on. No workbook. No User Form. No Code. No Data.

    Like I said, I can't test it. Have you put a Stop in to the module(s) and stepped it through with F8 to see what values you get? Is the Lookup Value what you expect it to be? Is the worksheet name correct? Is the Range address what you think it should be? is it finding the value it is looking for? Is the lookup value Text and the lookup Data Numeric, or vice versa?

    I don't even know what you mean by "it fired on first attempt then failed on second attempt". What did it do? What did it not do? Do you get an error message? If yes,what is it? Or does it do nothing? Have you disabled event handling and not re-enabled it?

+ 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. Display Cell within VLookup range that excel thinks matches the VLookup Value
    By headachexcelperson in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-04-2013, 04:56 PM
  2. [SOLVED] Vlookup is not working and giving =vlookup(B2,$T$2:$U$135,2,false) this kind of values.
    By yogeshsharma1981 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-09-2013, 04:08 PM
  3. how to bring all vlookup returns even with duplicate vlookup search keys
    By NYC4LIFE in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-06-2013, 04:53 PM
  4. vlookup? match? index? MULTIPLE criteria for vlookup search problem....
    By aborg88 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 02-11-2013, 09:56 AM
  5. Replies: 5
    Last Post: 07-29-2009, 07:53 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