+ Reply to Thread
Results 1 to 1 of 1

Manual entry error with 2 column data validation. Drop down list entry works fine.

  1. #1
    Registered User
    Join Date
    London, England
    MS-Off Ver
    Excel 2003

    Manual entry error with 2 column data validation. Drop down list entry works fine.

    Hi all,

    On my spreadsheet I am using data validation to enter values into a sheet.

    The data validation references a list (a named excel area) containing the following formulae
    =X6&" - "&Y6

    This produces a result of e.g. "1 - Invoice" being the concatenation of the values in the 2 fields X6 (=”1”) and Y6 (= “Invoice”). This full concatenation then appears in the validation dropdown list.

    I have vb code to select just the value "1" and put it in the spreadsheet.

    Essentially the code is:

    Private Sub Worksheet_Change(ByVal Target As Range)
    Target.Value = Left(Target.Value, InStr(1, Target.Value, " ") - 1)
    End Sub

    Basically this is just a way of showing 2 columns of data while only 1 gets input to the spreadsheet and it work fine.

    The problem is if I try to manually type a value into a cell with the above mentioned validation, I get a data validation error. It is only possible to enter a value in the cell using the drop down list.

    I can sort of see why this is happening:
    The value (e.g. “1”) entered is compared to the validation list value ("1 - Invoice"), the code sees they are different and gives an error.
    Is there any way to manually enter a value into the cell without getting the validation error?

    I am reasonably good at problem solving minor vb problem but this one has me stumped.

    I've seen this problem come up before but I've not seen a solution.

    Any help would be much appreciated.
    Last edited by yodbod; 10-06-2011 at 07:15 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread


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