+ Reply to Thread
Results 1 to 9 of 9

VLookUp issue

  1. #1
    Registered User
    Join Date
    01-09-2013
    Location
    Mississauga, Canada
    MS-Off Ver
    Excel 2007
    Posts
    8

    VLookUp issue

    Hi all,

    Here's the story. I have a table whose first column's got all the dates of the year (all 365 of them) and a second column that has an integer number (assigned to each date). I am trying to use the VLookUp function in VBA to search today's date within the first column, and return its corresponding integer value. Well, today's not my day.

    I want to use this value to refer to a column in another worksheet (in this sheet, the columns are labelled across by these integer values).

    My Lookup function just won't work. Anyone bold enough to tackle this problem?

    Thanks a bunch.
    lunaticlion

  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
    48,973

    Re: VLookUp issue

    That shouldn't be difficult. We can't really tell you what might be wrong with your formula without seeing it, and, if the formul looks OK, we'd need to see the data.

    So, best bet, upload a sample workbook.

    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
    Registered User
    Join Date
    01-09-2013
    Location
    Mississauga, Canada
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: VLookUp issue

    Hi TMS,

    I've uploaded a mock workbook. Kindly take a look. I'm sure it's the way I'm calling the function that's causing the issue.
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    09-04-2007
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    133

    Re: VLookUp issue

    Hey,

    This thread might be helpful.

    http://www.excelforum.com/excel-prog...or-1004-a.html

  5. #5
    Valued Forum Contributor
    Join Date
    07-29-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2003/Excel 2010
    Posts
    534

    Re: VLookUp issue

    In your macro "BossScript" i inserted the following (red) line of code to check the value of variable "deliverDate"
    Please Login or Register  to view this content.
    In the Immediate window, the result was:
    Please Login or Register  to view this content.
    Maybe not what you expected?

  6. #6
    Registered User
    Join Date
    01-09-2013
    Location
    Mississauga, Canada
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: VLookUp issue

    WHER,

    You're right, not what I expected at all. I was trying to assign each value contained in the column of D5 (in sheet "Main") to "deliverDate" one by one. The code was my attempt to select a dynamic range, and probably goofed. Any tips?

    LL

  7. #7
    Registered User
    Join Date
    01-09-2013
    Location
    Mississauga, Canada
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: VLookUp issue

    I got the VLookup function to work in one module, but doesn't work in another module of the same workbook :S

    This works:
    Please Login or Register  to view this content.
    But this doesn't:

    Please Login or Register  to view this content.
    Help, please!
    Last edited by lionlunatication; 01-20-2013 at 07:17 PM.

  8. #8
    Registered User
    Join Date
    01-09-2013
    Location
    Mississauga, Canada
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: VLookUp issue

    Nvm, solved it! Just conflicting conditional statements...

  9. #9
    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
    48,973

    Re: VLookUp issue

    Thanks for letting us know. Glad you have a solution.


    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

+ 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