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.

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
Post a Comment