Automatically create comments based upon cell value and related datain database

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
 
J

JLatham

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.
 
S

Stefi

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:
 
D

dladilaco

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top