+ Reply to Thread
Results 1 to 5 of 5

Override v lookup

  1. #1
    Registered User
    Join Date
    04-23-2007
    Posts
    54

    Override v lookup

    Hello.I have vlookup formula in a columb b 13 to b 60 =IF(A13="","",VLOOKUP(A13,WORKERS,4,0)). I would like to be able to override the result with a data validation listbox.I can do this but loose the v lookup formula after entering in information through data validation.I copy this sheet for the next days information so I want the vlookup formula to stay in the cells unless I want to over ride result again . Can I do this without macros.Thanks in advance.

  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,415

    Re: Override v lookup

    Can I do this without macros.
    I would think not. A cell can have a formula, in this case VLOOKUP, or a value, but not both. In your example, the value would be obtained from a Data Validation drop down box. It would be just the same as typing a value directly into the cell, overwriting the formula.

    Regards
    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
    04-23-2007
    Posts
    54

    Re: Override v lookup

    Thanks for the reply.Thats kind of what i thought.Is there a way to do it with a macro.Thanks in advance

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

    Re: Override v lookup

    It's possible but it would need some setting up.

    This is one way to do it; there could be other and better ways.

    In the example code that follows, I have used a Workbook_SheetActivate event monitor. This needs to go in the Workbook Class Module, not an ordinary module. It monitors sheet activation(s)... all sheet activations. There is no checking in this code but you might want to consider testing which sheet is activated. This could be done by checking part of the sheet name or testing specific cells on the active sheet, for example, headers.

    The code checks a "marker" cell (A1) for the value "new" (without quotes). If it finds it, it resets the marker to nothing , clears the search range and re-inputs the formulae and validation. You didn't specify what the validation list is and you didn't provide an example workbook, so I've just made something up to test the principle.

    So, if you wanted to reset any sheet (with this structure) you could put "new" (without the quotes) in cell A1, activate another sheet and then re-activate the original sheet.

    You could also record a macro which copies the sheet and puts "new" in cell A1 on the copy; I haven't done that as you may already have some code to copy the sheet(s).

    Please Login or Register  to view this content.


    If cell A1 is in use, you'll need to pick another suitable cell and modify the code appropriately. I've used With ... End With so you only need to change the cell address once.

    Regards

  5. #5
    Registered User
    Join Date
    04-23-2007
    Posts
    54

    Re: Override v lookup

    Thanks for your help.i will play around with this.

+ 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