I would like Excel to show messages on the screen depending on the cell selected by the user. The idea is to offer assistance on what sort of information is to be entered when the user locates the cursor on a cell, typically a heading.
I have prepared some easy VBA code that calls for a combination of Match and Index functions. The code is below. The problem is that it only works if the cell in which the user is locating the cursos is not combined. The problem is that I have many headings that are the result of combining two or more cells into one and I would like to have a solution that works also in such cases. This is why I would really appreciate some assistance on this matter.
Note: if someone has a different solution to achieve the same, that could also be handy.
Thanks,
Marc
VBA CODE:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim wsCt As Worksheet
Dim strCt As String
Dim mchCt As String
Dim rngCt As Range
Set wsCt = Worksheets("CONFIGURATION")
Set rngCt = wsCt.Range("CommentList")
Set rowCt = wsCt.Range("CommentRow")
On Error Resume Next
mchCt = Application.WorksheetFunction.Match(Target.Value, rowCt, 0)
strCt = Application.WorksheetFunction.Index(rngCt, mchCt + 1, 1)
Range("c1").Value = strCt
End Sub
Bookmarks