: I now have my spreadsheet working with your help which is
: greatly appreciated.
You are welcome.
: Just one question. I did not include your following line of
: code:
It restricts the range to a single cell in the "D" column
which you can click on and get the form.
: If Target.Column = 4
Fourth column ("D").
: And Target.Columns.Count = 1
One column wide.
: And Target.Rows.Count = 1
One Row tall.
Try selecting a group of cells without this and with it to see
the difference. I assumed you only wanted the form to pop up when
you selected a single cell in the fourth column.
I could write it this way as well.
If Target.Column = 4 And Target.Cells.Count = 1 Then
If you start getting "out of memory errors" you'll need to
move the Load and Unload statements to the Worksheet_Activate and
Worksheet_Deactivate (or the workbook Open and BeforeClose) sub
routines and then hide and show the form as appropriate.
Private Sub Worksheet_Activate()
Load frmItemCodes
End Sub
Private Sub Worksheet_Deactivate()
Unload frmItemCodes
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
' Ignore multi-cell selections.
If Target.Column = 4 And Target.Cells.Count = 1 Then
frmItemCodes.Show
End If
End Sub
Private Sub lboItemCodes_Click()
ActiveCell.Value = lboItemCodes.Value
frmItemCodes.Hide
End Sub