Results 1 to 6 of 6

VBA - Distinguishing when a cell is edited by a data validation list or free fromat text e

Threaded View

  1. #1
    Registered User
    Join Date
    03-17-2014
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    4

    VBA - Distinguishing when a cell is edited by a data validation list or free fromat text e

    Hi All,

    Does anyone know of VBA code which can distinguish whether a cell has been edited by:

    selecting an option from a data validation list (DVL)
    or
    manually editing the text in a cell?

    The ""Show error alert after invalid data is entered"" option is unticked to allow both selection from the DVL as well as free format text entries.

    The problem arises when using the code below which makes an edited cell within a range display the new value as well as the prior value(s). This works well when using the DVL but not when editing the cell.

    Is there any code which can distinguish between the 2?

    Hope this makes sense, please let me know if anything requires further clarification.

    Many thanks in advance
    JLD



    Public Prior As String
    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Count > 1 Then Exit Sub
    Application.EnableEvents = False
        If Not Intersect(Target, Range("E3:E100")) Is Nothing Then
            If Target <> """" Then
                If Prior <> """" Then Target = Target.Text & Chr(10) & Prior
                Prior = Target
            Else
                Prior = """"
            End If
        End If
    Application.EnableEvents = True
    End Sub
    Last edited by JBeaucaire; 03-20-2014 at 02:34 PM. Reason: added missing code tags, please read and follow the forum rules, link above in the menu bar. Thanks.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Data Validation and Free Text
    By Kumara_faith in forum Excel General
    Replies: 4
    Last Post: 01-22-2015, 11:03 AM
  2. Replies: 4
    Last Post: 12-19-2013, 10:44 AM
  3. Allow Free Form with Double Validation List
    By maacmaac in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-09-2010, 02:14 PM
  4. Stopping free text entry in validation cell
    By smf in forum Excel General
    Replies: 2
    Last Post: 12-15-2005, 03:50 PM
  5. [SOLVED] text is deleted when cell is edited
    By GRIFFO in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-23-2005, 11:05 PM

Tags for this Thread

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