Nesting information

A

andyp161

Hello there,

I am currently in the process of setting up a stock contol spreadsheet
Each item of stock is issued with a particular code. Is there anywa
that I can programme Excel to store information on a particular code.
That is, if I were to type the code AFS341 in a cell, I would like th
stock description to be some how nested in the cell so that if a use
wanted to find out the stock description, they could do someting lik
double click on the code to reveal the nested description. I hope thi
makes sense to you.

Many thank
 
K

K Dales

Here is a simple routine that can be modified to do what
you want. You will need to set up a lookup table for the
VLOOKUP function somewhere in your workbook (I am using
the named range "LookupRange" in the example) - the lookup
range should be a sorted 2-column list with your codes in
the first column and the corresponding descriptions in the
2nd column.

Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As
Object, ByVal Target As Range, Cancel As Boolean)

Dim ShowMe As Variant

ShowMe = WorksheetFunction.VLookup(Target.Value, Sheets
("Sheet1").Range("LookupRange"), 2, False)

MsgBox Target.Value & ": " & ShowMe

End Sub
 
A

andyp161

Thank you 'K Dales'

Unfortunately I do not have any experience in programming Excel -
assume what you have posted is syntax?? Please could you offer a brie
explanation of where and how I can carry out your proposal.

Many thank
 
Top