excel - Add random images to labels -


userform 2 = 36 buttons (btn1 thru btn36) each button has image on it. when click "add" button 3 randon images on buttons show in userform 1 3 lables says random image 1.

right when click "add" button, brings userform1.  when click "ok" on userform1 state 3 buttons inserted userform1 on spreadsheet.

to choose random button image you'll need use collection me.controls on form. example:

dim ccont control each ccont in me.controls     'do stuff here next ccont 

if put watch on variable ccont, can see properties each control has. first, have filter out controls buttons. have @ image property button grab , set on second form.

finally, introduce random element, use rand() function. return random number between 0 , 1. if multiply number of controls in me.controls, , round integer, random control. make sure control indexed button, , can use button's image 1 of random images.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -