Thursday, 15 September 2011

vba - automatically close excel userform when change sheet -



vba - automatically close excel userform when change sheet -

i have userform automatically appears when new sheet created pivot table drilldown. trying figure out how have userform automically close if user navigates other sheet in workbook.

you can utilize sheetactivate event of workbook object check name of worksheet active , take action accordingly. example:

private sub workbook_sheetactivate(byval sh object) if sh.name = "sheet1" , userform1.visible unload userform1 end if end sub

this event available in thisworkbook module of excel workbook. believe userform need modeless users able alter sheets while form visible.

you can read workbook.sheetactivate event here.

vba excel-vba userform

No comments:

Post a Comment