View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default passing a comboxbox result into sheets.select

The problem is that you are adding the items in the same
procedure as you are using to select the sheet.

Remove the following lines from you existing code

Chapter = ComboBox8.Value
Sheets(Chapter).Select

and insert the following code in the sheet's code module:

Private Sub ComboBox8_Change()
Dim Chapter As String
Chapter = Me.ComboBox8.Value
Worksheets(Chapter).Select
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"tbaam" wrote in message
...
I have a form that has a combo box in it. The combo box allows
the user to
select a chapter. The chapter happens to be worksheet in a
workbook.

How do i pass from the combo box into the macro.

This is what I want:
With ComboBox8
.AddItem "Chapter 1"
.AddItem "Chapter 2"
.AddItem "Chapter 3"
End With
Chapter = ComboBox8.Value
Sheets(Chapter).Select

*** if I write Sheets("Chapter 1") it works great...but just
putting it
Chapter fails