View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
STEVE BELL STEVE BELL is offline
external usenet poster
 
Posts: 692
Default drop down problem

Here is some code I use with a list box on a worksheet.

For the second part - you can set the ListBox1_Exit event
to populate the second box. The easiest way is to set the
rowsource propert of the 2nd listbox. You should be able to use
range names.

You can adapt it to the initialize event of the form.

Private Sub Worksheet_Activate()
Dim cell As Range, ws As Worksheet
Application.ScreenUpdating = False
Dim x As Integer
With ActiveSheet
.ListBox1.Clear
x = 1
For Each ws In ActiveWorkbook.Worksheets

If ws.Name < "Index" Then
.ListBox1.AddItem ws.Name
End If
Next
End With
Range("a1").Select
Application.ScreenUpdating = True
End Sub

--
steveB

Remove "AYN" from email to respond
"Rob Hargreaves" wrote in message
...
I would like to create a drop down on my form to list each sheet name.

I realise to do this I could create a list on a seperate sheet and make it
a named range containing all the sheet names

Is it possible to add to this and to have another drop down underneath
that
which would take the sheet name selected and use values in a dynamic range
on the sheet name selected as entries to the second drop down (like a
conditional drop down based on the first choice)

So if the sheet name selected is sheet1 and all the possible sheets to
select have a dynamic
range in row 1 columns B:? (? being the last column in the range covered
dynamically)

The dynamic range would have to applicable to each sheet found in the
first
drop down list not a named dynamic range on each sheet.

Is this possible

Thanks

Rob