: An example of my Table is as follows:
: Item Code Description XA9301 Alpha numeric
: Chars Max of 20 XA9302 Childrens shoes XA9303 Childrens
: Pants XA9305 Baby Growers XA9306 Baby Feeders XA9307
: Dolls Clothes XA9308 Plastic Cups XA9327 Plastic Saucers
: XA9328 Swimwear
Erm. All in one cell! Would it have killed you to take the
time to place that in a tab delimited format for this email so I
could have copied it into a spread sheet easier?
Item Code Description
XA9301 Alpha numeric Chars Max of 20
XA9302 Childrens shoes
XA9303 Childrens Pants
XA9305 Baby Growers
XA9306 Baby Feeders
XA9307 Dolls Clothes
XA9308 Plastic Cups
XA9327 Plastic Saucers
XA9328 Swimwear
Go to the VBA Project and add this to the sheet code. (This
code may wrap in your window.) Change the 4 to whichever column
you want to watch (4 is column D).
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column = 4 And Target.Columns.Count = 1 And Target.Rows.Count
= 1 Then
Load frmItemCodes
frmItemCodes.Show
End If
End Sub
Create a form named frmItemCodes. On that form add a list box
named lboItemCodes. Set the following:
BoundColumn = 1
ColumnCount = 2
ColumnHeads = true
RowSource = a2:b10 (Assumes table with headings is at a1:b10)
Double-click somewhere on the form and add this code.
Private Sub lboItemCodes_Click()
ActiveCell.Value = lboItemCodes.Value
Unload frmItemCodes
End Sub
When you click on a single cell in the watched column, the
SelectionChange event loads the form. Clicking on a selection
unloads the form. I found the form block my view of the cell. You
can position the form by changing its Position properties.
: The table is static and does not change.
: The Tables Range has not been named.
: There is only one table.
For readability, place your answers below each question. It
will also make it easier for you not to miss a question and easier
for other people reading the message.