Automatically create comments based upon cell value and related datain database

  • Thread starter Thread starter dladilaco
  • Start date Start date
D

dladilaco

Hi all,
I am creating a follow up system for car fleet management.
Is it possible to create a comment in a cell based upon the content in
that cell and a related database with the car details.
For example :
In a cell next to an employee name I fill in ABC123 (number plate) and
in the comment box I would like to see the details (Toyota Avensis
contract number 123456) This data exists in a database.
Thanks in advance for your feedback
Dirk
 
What kind of database is the information you want in? Access, another Excel
worksheet, a different Excel workbook?
Regardless, this will no doubt be done with a Worksheet_Change() event
handling VBA macro.
 
Try this Change event macro:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 1 Then ' "if number plate" column is e.g. A
Target.ClearComments
commtext = retrievefromDB(Target.Value) 'create your retrieve function
With Target.AddComment
.Visible = False
.Text commtext
End With
End If
End Sub

Regards,
Stefi

„[email protected]†ezt írta:
 
JLatham said:
What kind of database is the information you want in? Access, another Excel
worksheet, a different Excel workbook?
Regardless, this will no doubt be done with a Worksheet_Change() event
handling VBA macro.
 
Back
Top