+ Reply to Thread
Results 1 to 3 of 3

Vlookup changed validated cell value in macro

  1. #1
    Registered User
    Join Date
    04-30-2004
    Posts
    78

    Vlookup changed validated cell value in macro

    I have a worksheet containing a cell (say A1) that has a validated list of times (data/validation/list) where the cells in the list contain times in 8 minute increments. The user can select cell A1 and manually select any of the validated times from the list.
    A vlookup formula on this worksheet uses the content of cell A1 to look for this time in another section of the worksheet. When the time is selected manually, the vlookup formula works properly.

    As part of a macro, the macro will change the time in cell A1. I do this in the macro by selecting and copying the desired time from the validation list and pasting it into A1. Cell A1 does change to the new value, however the vlookup formula that uses A1 shows a result of #N/A. If I manually change the time, it again works. I am looking for a way to have the macro change this cell to another time and for the vlookup formula to work as it should. Any suggestions?
    Last edited by nebb; 07-03-2009 at 01:10 PM.

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

    Re: Vlookup changed validated cell value in macro

    Did you populate your val-list by entering values in the source box manually, or, are you using a range of cells?

    Check that your dropdown list has no spaces .

    Somewhere on your sheet, select an unused cell and enter the formula =A1; format the cell as number. Back in A1 select a value from the dropdown list.

    Observe that the value in the test cell is a decimal greater than 0.0 and less than 1.0; if otherwise, then the list may have untimely characters somewhere.
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    04-30-2004
    Posts
    78

    Re: Vlookup changed validated cell value in macro

    Response to protonLeah
    The val-list is from G1 to G25. I entered 08:00 in G1. In G2, I put the formula G1*8/1440 and filled down to G25. I then did a copy/paste special/value to all the cells and made sure they are all formatted as time.
    There are no spaces in the val-list.
    Your suggestion of creating a cell with the formula =A1 formatted as numeric and then back in A1 select a value from the dropdown list does produce a number between 0 and 1.

+ 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