Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 81
Default Command Button Problem

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
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Command Button Problem

Hi,

This error would be generated if you had 2 subroutines with the same name so
check carefully that they are all different. There's nothing wrong with the
code in the sub you posted.

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

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Command Button Problem

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

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 81
Default Command Button Problem

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

  #5   Report Post  
Posted to microsoft.public.excel.misc
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



  #6   Report Post  
Posted to microsoft.public.excel.misc
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

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 81
Default Command Button Problem

Hi Mike it's me again, Thank you for your interest, actually you were right,
in my last message I told you that the usual default items were not showing,
actually for some reason instead of following command button 9, the default
items followed command button 1, but cursor followed command button 9, so I
did not look further up.

Thanks once again

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

Reply
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
Problem with command button name Jason[_9_] Excel Discussion (Misc queries) 10 October 19th 07 09:54 PM
Command button AhmetDY Excel Discussion (Misc queries) 1 October 17th 07 11:36 AM
strange command button problem David Excel Discussion (Misc queries) 0 March 20th 06 03:06 PM
Using a command button to add Chance Excel Discussion (Misc queries) 5 October 21st 05 08:08 PM
Command Button Mark New Users to Excel 2 March 23rd 05 10:33 AM


All times are GMT +1. The time now is 02:42 AM.

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

About Us

"It's about Microsoft Excel"