Results 1 to 4 of 4
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Show comment... (2000 r s1)

    Assuming i have this sheet...
    Is possoble, when the cursor mouse, go in one cell of column G, show the text based into the db into column J, similar when i use the tipical instruction in Excel "Insert Comment!?
    Example the cursor is in G2 show "NOTE_FOR_00" , the cursor is in G4 show "NOTE_FOR_00", the cursor is in G10 show "NOTE_FOR_99", ecc...

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Show comment... (2000 r s1)

    You can use Data | Validation... for this. Run the following code:

    Sub AddInstructions()
    Dim oCell As Range
    For Each oCell In Range(Range("G2"), Range("G2").End(xlDown))
    With oCell.Validation
    .Add xlValidateInputOnly
    .InputTitle = "Instruction"
    .InputMessage = Application.WorksheetFunction.VLookup _
    (oCell, Range("J2:K6"), 2, False)
    End With
    Next oCell
    End Sub

    If you want the text to be updated automatically if the user types something into column G, use this in the worksheet module for Foglio1:

    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim oCell As Range
    If Not Intersect(Target, Range("G:G")) Is Nothing Then
    For Each oCell In Intersect(Target, Range("G:G"))
    With oCell.Validation
    .Add xlValidateInputOnly
    .InputTitle = "Instruction"
    .InputMessage = Application.WorksheetFunction.VLookup _
    (oCell, Range("J2:K6"), 2, False)
    End With
    Next oCell
    End If
    End Sub

  3. #3
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Show comment... (2000 r s1)

    ...naturally GOOD CODE!
    But is possible also to show text without click on a cell....?
    Simiilar when the pointer mouse go on a cell in column G without click on a cell?
    peraph "to graze" in enlglish?

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Show comment... (2000 r s1)

    You can use comments instead of Validation. This will work if the user has set cells to display a comment indicator only in Tools | Options...

    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim oCell As Range
    On Error Resume Next
    If Not Intersect(Target, Range("G:G")) Is Nothing Then
    For Each oCell In Intersect(Target, Range("G:G"))
    oCell.Comment.Delete
    oCell.AddComment Application.WorksheetFunction.VLookup _
    (oCell, Range("J2:K6"), 2, False)
    Next oCell
    End If
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •