View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default More Problems with CBO's

Your ^top macro should include a line of code like

activesheet.dropdowns("Combobox1").listIndex = 1
Range("A1").Select

--
Regards,
Tom Ogilvy


"mtm4300 via OfficeKB.com" wrote:

I have a worksheet that displays Example Problems. The worksheet has hundreds
of rows of text and text boxes. I created a combobox that lists each Example
Problem so the user can click on the problem he/she wants and the macro will
take them to that problem (a certain row in the worksheet). To help the user
get back to the top, I created Label names "^top" at the end of each Example
Problem. This Label takes the user back to the top of the worksheet (A1).
However, when I do this, the combobox remains with the item the user last
clicked on. I would like for the combobox to display the first Example
Problem because the first Example Problem begins on cell A1. I also have
protected the sheet., so if I delete the box I get an error. I tried
unprotect/protect in my macro, but I would rather be able to change the
combobox without deleting it. The code for my combobox is:

Private Sub ComboBox1()
With Worksheets(45).Shapes.AddFormControl(xlDropDown, _
Left:=440, Top:=47, Width:=240, Height:=15)
.ControlFormat.DropDownLines = 9
.ControlFormat.AddItem "Example 1: Method 1, Circular Corrugated Pipe", 1
.ControlFormat.AddItem "Example 2: Method 1, Deformed Smooth-Interior
Pipe", 2
.ControlFormat.AddItem "Example 3: Method 1, Circular Smooth-Interior
Pipe", 3
.ControlFormat.AddItem "Example 4: Method 2, Circular Corrugated Pipe", 4
.ControlFormat.AddItem "Example 5: Method 2, Circular Corrugated Pipe
(SPM)", 5
.ControlFormat.AddItem "Example 6: Method 2, Deformed Corrugated Pipe", 6
.ControlFormat.AddItem "Example 7: Method 3, Circular Corrugated Pipe", 7
.ControlFormat.AddItem "Example 8: Method 3, Deformed Corrugated Pipe
(SPAA)", 8
.ControlFormat.AddItem "Example 9: Method 3, Deformed Corrugated Pipe
(SPS)", 9
.Name = "ComboBox1"
.OnAction = "ComboBox1_Change"
End With
End Sub

The code for the "^top" button is simply a Sub with Range("A1").Select

Any help would be greatly appreciated.

--
Message posted via http://www.officekb.com