View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default Programmatically allowing user to select worksheet

How about something like this. Place a ComboBox (from the control toolbox) on
a sheet and add the following code... You will probably want to clean it up a
bit but it allows the user to select a sheet and you can then capture the
sheet name...

Public wksSelected As Worksheet

Private Sub ComboBox1_Change()
If ComboBox1.Text < "" Then
Set wksSelected = Sheets(ComboBox1.Text)
wksSelected.Select
End If
End Sub

Private Sub ComboBox1_GotFocus()
Dim wks As Worksheet

With ComboBox1
.Clear
For Each wks In Worksheets
If wks.Name < Me.Name Then .AddItem wks.Name
Next wks
End With
End Sub
--
HTH...

Jim Thomlinson


"Barb Reinhardt" wrote:

I'd like to instruct the user to select a worksheet to work on and then I'll
identify it as WS1 or WS2. How would I do this?

Thanks,
Barb Reinhardt