excel - Using a variable in 2 subs -


i have on 20 subs in excel file, , userforms. in 1 userform, there cancel button, cannot use "if cancel = true" kinda code in sub. don't know why, never comes true. thought if can state variable true in userform, check variable in sub, may work unfortunately couldn't figure either. in below can find both codes;

this userform;

private sub sheet_iptal_click() dim sheet_iptal string sheet_iptal = true thisworkbook.worksheets("storyboard").delete yeni_sheet_adi_olustur.hide msgbox "islem iptal edildi." yeni_sheet_adi_olustur.yeni_sheet.value = "" end sub 

and here part of other sub want check "sheet_iptal" situation;

if sheet_iptal = true     thisworkbook.worksheets("storyboard").delete     goto son end if 

what trying achieve in here is, if cancel button has been used, go "son" of specific sub. open suggestions here.

the userform .tag property can set on button click events:

private sub buttonok_click()     me.tag = "ok"     me.hide end sub  private sub buttoncancel_click()     me.tag = "cancel"     me.hide end sub 

and check it's value after showing form:

userform1.show msgbox userform1.tag <> "ok" 

Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -