vba: userform functions -


i have sub activated button on userform. basic procedure click

1) run sub based off of user inputs

2) select results sheet

3) display results

4) unload userform

i've run problem because want try , put bounds on user input value , if user inputs out of range message box pop notifying them of range. i've been able accomplish simple task through use of if/then loop. after user exits out of message box want keep userform displayed along original user inputs , allow user change input. after user clicks 'ok' on message box, click sub continues procedure , unloads userform , selects results worksheets. there simple 1 line code can put after msgbox state preserve userform instead of making user re-enter values?

edit - general gist of code follows:

private sub commandbutton1_click()     propertysearch.search     activesheet.name = "searchresult"     cells(1, 1).select     unload ilsearch end sub  sub search()     if (textbox1 , textbox2 <= 8) , (textbox1 , textbox2 > 0)     '     'performs desired function     '     else: msgbox ("database includes ionic liquids maximum of 8 carbons in cation")     end if 

i turn search function returns true or false if input within bounds or not:

function search() boolean     if (textbox1 , textbox2 <= 8) , (textbox1 , textbox2 > 0)       search = true    else       search = false    endif  end function 

then exit sub if input not meet bounds:

private sub commandbutton1_click()      if(not propertysearch.search)        msgbox("your error message here")        exit sub     endif      ' rest of routine  end sub 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -