+ Reply to Thread
Results 1 to 2 of 2

Can I display comments in a validation list

  1. #1
    Stoke
    Guest

    Can I display comments in a validation list

    I am new to using these Validation lists - I have comments associated with
    the validation list, and I am wondering if there is a way to bring the
    comment into the target cell with the contents of the Validation list cell
    when it is selected from the drop-down box. Thanks

  2. #2
    Dave Peterson
    Guest

    Re: Can I display comments in a validation list

    Maybe...

    You might be able to use a macro...

    I created a list on Sheet1. I named it myList (to be used with
    data|validation).

    Then on sheet2, I used data|validation in A1 and pointed to that list on sheet1.

    Place the code in the sheet2 worksheet module.

    rightclick on the worksheet tab with the data validation. Select view code.
    Paste this in the new code window:

    Option Explicit
    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim res As Variant
    Dim myList As Range

    If Target.Cells.Count > 1 Then Exit Sub
    If Intersect(Target, Me.Range("a1")) Is Nothing Then Exit Sub
    If Target.Value = "" Then Exit Sub

    'clear previous comment
    If Target.Comment Is Nothing Then
    'do nothing
    Else
    Target.Comment.Delete
    End If

    Set myList = Worksheets("sheet1").Range("mylist")

    res = Application.Match(Target.Value, myList, 0)

    If IsError(res) Then
    'something very bad happened
    Else
    If myList(res).Comment Is Nothing Then
    'do nothing
    Else
    Target.AddComment Text:=myList(res).Comment.Text
    End If
    End If

    End Sub

    Then back to excel and test it out.

    (This won't work with xl97.)

    Stoke wrote:
    >
    > I am new to using these Validation lists - I have comments associated with
    > the validation list, and I am wondering if there is a way to bring the
    > comment into the target cell with the contents of the Validation list cell
    > when it is selected from the drop-down box. Thanks


    --

    Dave Peterson

+ 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