View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default Command Button Problem

Hi,

No the number of sub's isn't a problem and I,m still of the view that the
problem is a duplicate sub.

Try this. In a brand new and empty workbook put 2 command buttons on a
worksheet and right click the first and view code and enter this

Private Sub CommandButton1_Click()
MsgBox "Hello"
End Sub

go back to the worksheet and right click the second and view code and you
should see this

Private Sub CommandButton2_Click()

End Sub

change the 2 to a 1 so the code is identical to the first
Go back to the worksheet and click Button 1 and you will get

Compile error:

Ambiguous name detected: CommandButton1_Click

Is this the same error you are getting?

Mike

"albertmb" wrote:

Thank You for answering Mike. I have looked at all the subs very carefully
but I have no double entries. Is it possible that I reached the limit for
entering subs?

"Mike H" wrote:

Hi,

I should have added that you can't hide all sheets in a workbook you must
leave at least one sheet visible and I assume you are doing this with the
sheet that has these buttons on.

Mike

"albertmb" wrote:

Hi everyone, can you please help me on this problem.

I have a multi sheet document and not to create confusion I hid all sheets
and assigned a command button to each sheet to unhide. All worked fine up to
Button 9, but when it came to button 10 I got this error:

"Ambiguos name detected: CommandButton10_Click()".

The Sub is as follows:

Private Sub CommandButton10_Click()
Sheets("Cost Lm").Visible = True
Sheets("Cost Lm").Select
End Sub

Thank You
Albert