Hi everyone!
Could someone please explain how can I suppress events on user forms in Excel please?
I've got a workbook with 2 sheets.
My goal is to mark the checkbox on sheet1 that will hide some rows on sheet2.
Now the code for hiding works just fine, but it's the jumping from sheet1 to sheet2 is what I would like to suppress.
Now I've googled quite a bit and I've found these 2 links:
1) Suppressing Events In UserForms
2) http://www.mrexcel.com/forum/excel-...ng-events-initialize-subroutine-userform.html
3) excel vba userform enableevents - Stack Overflow
But I just can't figure out what do I need to add/remove from my code for it to work.
Here's the code:
I'm doing it in a Module sheet and get the "Invalid use of me keyword" on line 8..
Thanks a lot!
Could someone please explain how can I suppress events on user forms in Excel please?
I've got a workbook with 2 sheets.
My goal is to mark the checkbox on sheet1 that will hide some rows on sheet2.
Now the code for hiding works just fine, but it's the jumping from sheet1 to sheet2 is what I would like to suppress.
Now I've googled quite a bit and I've found these 2 links:
1) Suppressing Events In UserForms
2) http://www.mrexcel.com/forum/excel-...ng-events-initialize-subroutine-userform.html
3) excel vba userform enableevents - Stack Overflow
But I just can't figure out what do I need to add/remove from my code for it to work.
Here's the code:
Code:
[COLOR=#011993][FONT=Menlo]Public[/FONT][/COLOR][COLOR=#000000][FONT=Menlo] EnableEvents [/FONT][/COLOR][COLOR=#011993][FONT=Menlo]As[/FONT][/COLOR][COLOR=#011993][FONT=Menlo]Boolean[/FONT][/COLOR][FONT=Menlo]
[/FONT]
[FONT=Menlo][COLOR=#011993]Private[/COLOR] [COLOR=#011993]Sub[/COLOR] UserForm_Initialize()[/FONT]
[FONT=Menlo] Me.EnableEvents = [COLOR=#011993]True[/COLOR][/FONT]
[COLOR=#011993][FONT=Menlo]EndSub[/FONT][/COLOR]
[FONT=Menlo]
[/FONT]
[FONT=Menlo]Private Sub CheckBox4_Click()[/FONT]
[FONT=Menlo][COLOR=#011993]If[/COLOR] Me.EnableEvents = [COLOR=#011993]False[/COLOR] [COLOR=#011993]Then[/COLOR][/FONT]
[FONT=Menlo] [COLOR=#011993]Exit[/COLOR] [COLOR=#011993]Sub[/COLOR][/FONT]
[COLOR=#011993][FONT=Menlo]EndIf[/FONT][/COLOR]
[FONT=Menlo][COLOR=#011993]If[/COLOR] [Check Box 9].Value = 1 [COLOR=#011993]Then[/COLOR][/FONT]
[FONT=Menlo] Me.EnableEvents = [COLOR=#011993]False[/COLOR][/FONT]
[FONT=Menlo] Sheets("Proposal RUS").Select[/FONT]
[FONT=Menlo] Rows("171:184").Select[/FONT]
[FONT=Menlo] Selection.EntireRow.Hidden = [COLOR=#011993]True
[/COLOR][/FONT][COLOR=#011993][FONT=Menlo]Else[/FONT][/COLOR]
[FONT=Menlo] [Check Box 9].Value = 0[/FONT]
[FONT=Menlo] Sheets("Proposal RUS").Select[/FONT]
[FONT=Menlo] Rows("171:184").Select[/FONT]
[FONT=Menlo] Selection.EntireRow.Hidden = [COLOR=#011993]False[/COLOR][/FONT]
[FONT=Menlo] Me.EnableEvents = [COLOR=#011993]True[/COLOR][/FONT]
[COLOR=#011993][FONT=Menlo]EndIf[/FONT][/COLOR]
[COLOR=#011993][FONT=Menlo]EndSub[/FONT][/COLOR]
I'm doing it in a Module sheet and get the "Invalid use of me keyword" on line 8..
Thanks a lot!