+ Reply to Thread
Results 1 to 3 of 3

vlookup issue?

  1. #1
    Registered User
    Join Date
    11-04-2010
    Location
    Illinois
    MS-Off Ver
    Excel 2003, Excel 2010
    Posts
    86

    vlookup issue?

    Hi,
    The following code updates dates in a couple different spreadsheets for some calculations that are done for the previous day's work. Now, I didn't write this code and the person who did cannot be reached at all and the issue we are running into is that when the code is stepped into, it goes to the wrong date (11/1/2011) instead of (1/1/2011). I know it's kind of vague but I cannot be really specific b/c it's kind of sensitive data. However, I am more or less looking for ideas. Here is the code that seems to be giving the issue:

    Please Login or Register  to view this content.
    The bolded portion is the portion that when in debug mode, instead of giving 1/1/2011, keeps giving me 11/1/2011 and I don't know why. I thought I fixed it about an hour ago, but at this point, I don't know what Excel is doing anymore. Like I said, I know it's vague, but if someone who has ran into a similar problem, I'd like to know where you began to LOOK to find out why it kept giving you the wrong output.

  2. #2
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: vlookup issue?

    Where are you defining and assigning a value to "curDate"?
    Which is then passed to
    Please Login or Register  to view this content.
    This might well be where the problem lies

    Also
    Please Login or Register  to view this content.
    And
    Please Login or Register  to view this content.
    should be in separate lines.
    Last edited by Marcol; 01-04-2011 at 12:53 PM.
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  3. #3
    Registered User
    Join Date
    11-04-2010
    Location
    Illinois
    MS-Off Ver
    Excel 2003, Excel 2010
    Posts
    86

    Re: vlookup issue?

    currDate is defined in another procedure but i double checked it and it's okay. I just ran some tests and I got it too work but I don't understand why and maybe Marcol you can explain it.

    I changed the variable "arange" to a different range that included values from the year 2010 and 2011 values and it worked. However, I'm confused b/c when I kept it as it was before, I thought the whole purpose of that "find" part of the code was to be able to look through the range no matter what it is and find the right dates. Thus, how did changing the range get it to work right?

    Please Login or Register  to view this content.
    I changed the range of the bolded 'arange' but the next portion with the 'find' piece in it, why did changing the range make it work when the find code is supposed to just find it for me no matter what the range is?

+ 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