Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello All,
I have an information system that uses multiple Excel files with macros. On many of the sheets, we have a combo box that enables the user to hide and show certain informations. Here is an exemple of the code behind on of the sheet and it's combo Epargne : Private Sub Epargnes_Click() CallByName ActiveSheet, ActiveSheet.Cells(1, 10).Value, VbMethod End Sub Sub épargnes_tout() Unprotect ThisWorkbook.SIGPWD Rows("1:100").Hidden = False ' Affiche toutes les lignes Rows("15").Hidden = True ' Masque les lignes T12 Rows("21").Hidden = True ' Masque les lignes T12 Rows("27").Hidden = True ' Masque les lignes T12 Rows("33").Hidden = True ' Masque les lignes T12 Rows("39").Hidden = True ' Masque les lignes T12 Rows("45").Hidden = True ' Masque les lignes T12 Rows("57").Hidden = True ' Masque les lignes T12 Rows("41:46").Hidden = True ' Masque les Ã* déterminer Protect ThisWorkbook.SIGPWD End Sub Sub épargnes_seul() Unprotect ThisWorkbook.SIGPWD Rows("1:100").Hidden = False ' Affiche toutes les lignes Rows("15").Hidden = True ' Masque les lignes T12 Rows("21").Hidden = True ' Masque les lignes T12 Rows("27").Hidden = True ' Masque les lignes T12 Rows("33").Hidden = True ' Masque les lignes T12 Rows("39").Hidden = True ' Masque les lignes T12 Rows("45").Hidden = True ' Masque les lignes T12 Rows("57").Hidden = True ' Masque les lignes T12 Rows("47:51").Hidden = True ' Masque les comptes inactif Rows("41:46").Hidden = True ' Masque les Ã* déterminer Protect ThisWorkbook.SIGPWD End Sub Sub épargnes_compte() Unprotect ThisWorkbook.SIGPWD Rows("1:100").Hidden = False ' Affiche toutes les lignes Rows("11:46").Hidden = True ' Masque toutes les lignes épargnes Rows("52:63").Hidden = True ' Masque la fin du rapport Rows("29:46").Hidden = True ' Masque les Ã* déterminer Protect ThisWorkbook.SIGPWD End Sub On excel's version prior to 2003, everything works find. The click event is fired once when I chose an option of the combo and it then calls the appropriate function. On Excel 2003, the following error message occurs when I make a combo choice : Run-Time error '1004' : Application-defined or object-defined error and if I check the err.description, I get : Unable to set the Hidden property of the range class. The subs works well indepedently if I comment the event. On the debugger, the difference between Excel 2003 and the other versions is that the event is triggered multiple times in excel 2003 and only one time in the other versions! A simple solution is to use a boolean to know when to call the function (only once) but we have over a 100 sheets similar at this one so that would imply a lot of work. I'm currently trying to help someone who's installing this in Madagascar... Is there anything else to do? Thanks for your help Richard |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Cannot seem to Cancel EXCEL App Right Click Event using C# | Excel Programming | |||
Can VSTO handle a Picture click event in Excel? | Excel Programming | |||
Click event to run only once | Excel Programming | |||
Click event to run only once | Excel Programming | |||
Double-click event question, part 2 (Excel 97) | Excel Programming |