LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default Still Having Trouble with Combo Box

Tom O. helped me with a problem I had creating a varying combo box. I used
the code, but I am still having errors. The purpose of the program is to
eliminate a variety of outputs for the user (42 in all). I have two option
butions that will run a combobox. Each combobox (I have two) has 3 different
choices. From there, the user will select one of the 3 choices. The user's
selection will run another combobox. This combobox has 7 choices for the user.
The following code is only a part of the code.
I get two errors when I run this.
- "Permission Denied"
- And then the ".Name" creates an error.


If anyone can offer me any help, I would appreciate it.

Sub optmeasureAmaj_Click()

If optmeasureE.Value = True Then
CreateAMajor

End If

End Sub
Sub optmeasureAmin_Click()

If optmeasureM.Value = True Then
CreateAMinor

End If

End Sub
Sub CreateAMajor()


With Worksheets(1).Shapes.AddFormControl(xlDropDown, _
Left:=245, Top:=188, Width:=192, Height:=15)
.ControlFormat.DropDownLines = 3
.ControlFormat.AddItem "A", 1
.ControlFormat.AddItem "B", 2
.ControlFormat.AddItem "C*", 3
.Name = "CreateAMajor"
.OnAction = "cboChoice"
End With

End Sub
Sub cboCoice()

Dim idex As Long
On Error Resume Next
Worksheets(1).DropDowns("cboChoice").Delete
On Error GoTo 0

idex = Worksheets(1).DropDowns("CreateAMajor").ListIndex
With Worksheets(1).Shapes.AddFormControl(xlDropDown, _
Left:=245, Top:=359, Width:=192, Height:=15)
.ControlFormat.DropDownLines = 7
.Name = "cboCoice"
Select Case idex
Case 1
.ControlFormat.AddItem "A1", 1
.ControlFormat.AddItem "A2", 2
.ControlFormat.AddItem "A3", 3
.ControlFormat.AddItem "A4", 4
.ControlFormat.AddItem "A5", 5
.ControlFormat.AddItem "A6", 6
.ControlFormat.AddItem "A7", 7
.OnAction = "cboChoiceA_Click"

Case 2
.ControlFormat.AddItem "B1", 1
.ControlFormat.AddItem "B2", 2
.ControlFormat.AddItem "B3", 3
.ControlFormat.AddItem "B4", 4
.ControlFormat.AddItem "B5", 5
.ControlFormat.AddItem "B6", 6
.ControlFormat.AddItem "B7", 7
.OnAction = "cboChoiceB_Click"


Case 3
.ControlFormat.AddItem "C1", 1
.ControlFormat.AddItem "C2", 2
.ControlFormat.AddItem "C3", 3
.ControlFormat.AddItem "C4", 4
.ControlFormat.AddItem "C5", 5
.ControlFormat.AddItem "C6", 6
.ControlFormat.AddItem "C7", 7
.OnAction = "cboChoiceC_Click"


End Select
End With

End Sub

--
Message posted via http://www.officekb.com
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
linking a form combo box... results from the combo box to another Trey Excel Discussion (Misc queries) 1 July 15th 07 01:58 AM
combo reference on another combo box for picking address etc. kbjin Excel Worksheet Functions 1 December 8th 06 03:29 PM
"Combo Box - getting control combo box to stick in place in worksh ajr Excel Discussion (Misc queries) 1 February 16th 05 02:05 AM
"Combo Box - getting control combo box to stick in place in worksh ajr Excel Discussion (Misc queries) 0 February 15th 05 07:45 PM
trouble with combo box John Excel Programming 1 June 27th 04 12:01 AM


All times are GMT +1. The time now is 04:06 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"