View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.misc
albertmb albertmb is offline
external usenet poster
 
Posts: 81
Default Command Button Problem

Thanks once again Mike. I tryed them all but still same error. I even tryed
inserting new command buttons but still same error is comming up. I can
assure there are no double entries. It's my first time using command buttons
so I had to make sure I was doing nothing wrong. The only difference I could
see was that up to Button 7
I was getting this :
Private Sub CommandButton9_Click()

End Sub
by default, from button 8 I had to wright it myself.

Thanks
Albert
"Mike H" wrote:

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