ambigous name

dantb

Active Member
Joined
Mar 20, 2002
Messages
358
First time trying to write a frame with option buttons, keep getting error ambigous name. What I have is
Private Sub optSize_Click(Index As Integer)

This is the first line of all 3 click buttons. New at this,I cant figure out what is wrong. Thx Dan
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
On 2002-03-23 11:08, dantb wrote:
First time trying to write a frame with option buttons, keep getting error ambigous name. What I have is
Private Sub optSize_Click(Index As Integer)

This is the first line of all 3 click buttons. New at this,I cant figure out what is wrong. Thx Dan

Just guessing: Index is a reserved word in VB, so i or idx should work.
 
Upvote 0
HI

To add to Aladins comments

Its just VBA clashes with what ever.

Fix:

Simple change the Sub name to something else, i try to keep simple...

BTW the Sub name and the module name can not be the same this will error ... just in case
 
Upvote 0
Still trying, very much a beginer and trying to learn from a workbook. This is what I have.

Option Explicit
Dim PizzaSize As String
Dim PizzaCrust As String
Dim PizzaWhere As String


Private Sub Form_Load()
'Initialize pizza parameters
PizzaSize = "Small"
PizzaCrust = "Thin Crust"
PizzaWhere = "Eat In"
End Sub

Private Sub optSize_Click(Index As Integer)
'Read pizza size
PizzaSize = optSize(Index).Caption
End Sub
 
Upvote 0
This just doesn't like VBA

Private Sub Form_Load()
'Initialize pizza parameters
PizzaSize = "Small"
PizzaCrust = "Thin Crust"
PizzaWhere = "Eat In"
End Sub

Private Sub optSize_Click(Index As Integer)
'Read pizza size
PizzaSize = optSize(Index).Caption
End Sub

Why ? well, in VBA you have Userforms, not forms, they don't have a Load event, they have an Initialize event. You can't (Directly) have array of controls (the optSize looks like OptionButtons).
 
Upvote 0
the project is under a user form, The opsize is a text box, the codes I copyed, came directely out of my workbook. dont know if where it said (index) is looking for a number or what. Just kind of lost.
 
Upvote 0
Yes, it is looking for a number. Which in theory should represent the index number of the Text box that has been clicked.

Are there any more TextBoxes in there ? I believe more than one have the same name, which would cause the Ambigous name error.
 
Upvote 0
Yes I have three text boxs, which I tryed to name them the same name but it wouldnt let me. Wolking on that too !
 
Upvote 0

Forum statistics

Threads
1,213,527
Messages
6,114,150
Members
448,552
Latest member
WORKINGWITHNOLEADER

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top