Is it possible to modify the module so that it can view picture from the comment?
For example F5 should be able to display the picture after lookup E5.
For example F5 should be able to display the picture after lookup E5.
VBA Code:
Function VLOOKUPCMT(lookup_value As Variant, table_array As Range, col_index_num As Long, range_lookup As Long) As Variant
Application.Volatile
Dim xReturn As Variant
Dim yCell As Range
xReturn = Application.Match(lookup_value, table_array.Columns(1), range_lookup)
If IsError(xReturn) Then
VLOOKUPCMT = "Not Found"
Else
Set yCell = table_array.Columns(col_index_num).Cells(1)(xReturn)
VLOOKUPCMT = yCell.Value
With Application.Caller
If Not .Comment Is Nothing Then
.Comment.Delete
End If
If Not yCell.Comment Is Nothing Then
.AddComment yCell.Comment.Text
End If
End With
End If
End Function
Copying-Comments.xlsm | |||||||
---|---|---|---|---|---|---|---|
B | C | D | E | F | |||
2 | Copy Comments with VLOOKUP | ||||||
3 | |||||||
4 | Roll | Grade | Lookup For | Copy Comments | |||
5 | 1 | A | 1 | A | |||
6 | 2 | B | |||||
7 | 3 | C | |||||
8 | 4 | D | |||||
9 | 5 | F | |||||
Copy Comments with VLOOKUP |
Cell Formulas | ||
---|---|---|
Range | Formula | |
F5 | F5 | =VLOOKUPCMT(E5,B5:C9,2,FALSE) |