B
Brad K.
I now have pretty much everything working from the code (shown below) that
Tom Ogilvy posted for the listbox (thanks to all for responding).
I have 2 more questions on this. Firstly, I have not been able to program
ColumnHeads into the listbox (i.e. .ColumnHeads = True). What do I need to do
for this?
Next question - I will have several identical worksheets and would like this
macro to work in each one. Is this possible or do I just need to cut and
paste it into each worksheet.
Thanks in advance for any assistance.
Brad
My code now is:
Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim initialcell
Dim Initialcellr
Dim Intialcellafter
initialcell = ActiveCell.Value
Initialcellr = ActiveCell.Address
If ActiveCell.Value = "" Then
On Error Resume Next
Me.ListBoxes.Delete
On Error GoTo 0
If Target.Column = 3 Then
With Worksheets(1).Shapes.AddFormControl(xlListBox, ActiveCell.Left _
+ ActiveCell.Width + 10, ActiveCell.Top + 10, 200, 80)
.Name = "Listbox1"
' .ControlFormat.ListFillRange = "Sheet2!a1:a7"
'
.ControlFormat.AddItem "Bulk"
.ControlFormat.AddItem "Hospital"
.ControlFormat.AddItem "Line"
.ControlFormat.AddItem "Nasal"
.ControlFormat.AddItem "Misc."
.ControlFormat.AddItem ""
End With
Me.ListBoxes("Listbox1").OnAction = "Box_Click "
End If
End If
End Sub
Tom Ogilvy posted for the listbox (thanks to all for responding).
I have 2 more questions on this. Firstly, I have not been able to program
ColumnHeads into the listbox (i.e. .ColumnHeads = True). What do I need to do
for this?
Next question - I will have several identical worksheets and would like this
macro to work in each one. Is this possible or do I just need to cut and
paste it into each worksheet.
Thanks in advance for any assistance.
Brad
My code now is:
Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim initialcell
Dim Initialcellr
Dim Intialcellafter
initialcell = ActiveCell.Value
Initialcellr = ActiveCell.Address
If ActiveCell.Value = "" Then
On Error Resume Next
Me.ListBoxes.Delete
On Error GoTo 0
If Target.Column = 3 Then
With Worksheets(1).Shapes.AddFormControl(xlListBox, ActiveCell.Left _
+ ActiveCell.Width + 10, ActiveCell.Top + 10, 200, 80)
.Name = "Listbox1"
' .ControlFormat.ListFillRange = "Sheet2!a1:a7"
'
.ControlFormat.AddItem "Bulk"
.ControlFormat.AddItem "Hospital"
.ControlFormat.AddItem "Line"
.ControlFormat.AddItem "Nasal"
.ControlFormat.AddItem "Misc."
.ControlFormat.AddItem ""
End With
Me.ListBoxes("Listbox1").OnAction = "Box_Click "
End If
End If
End Sub