Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Problem with command button name | Excel Discussion (Misc queries) | |||
Command button | Excel Discussion (Misc queries) | |||
strange command button problem | Excel Discussion (Misc queries) | |||
Using a command button to add | Excel Discussion (Misc queries) | |||
Command Button | New Users to Excel |