Excel のこととか楽天とか いろいろ書いてみます・・・

【Excel/VBA】Janken game 01


    Janken icon




※Please correct my English if you find any mistakes. Thank you.


Save as "xlsm" with any name.


Janken Game


Prepare images of Rock, Paper, and Scissors

You can just show the text Rock, Paper, and Scissors, but It is boring, I think.

You can draw them, take photos, or copy them from websites and save them as "bmp", or "jpg".


* In Japanese law, we can use pictures or drawings just for ourselves as long as they are not in public.
   Please obey your country's laws for copyright issues.


Open VBE

[Developer] tab > [Visual Basic] 

Check this article for more detail.




Create form

Might be Saying "Creating the screen of the game" is more understandable for beginners.


Go [Insert] > [Userform] and the new user form will be added and appear with the toolbox.

    Add userform

You might lose it if your monitor is big or using multiple monitors but the toolbox appears somewhere for sure.


Let's make the game appearance referring to the draft drawing.


Create the parts 


Add the labels on the form.

Those are labels in red frames. 

    Label parts


Those properties are below.

    Properties for labels


Change favorable font type, font size, and font color.


Option buttons

Add three option buttons.

    Option buttons


Properties for option buttons

    Option buttons' properties



Add images for showing pictures you and the computer selected.



    Image control


Properties for the images.

    Properties for images





They are also images but the setting is a bit different.

Set the size smaller and you have to have the pics of Rock, Paper, and Scissors on your PC.


Click the image and go to the [Piture] property.

Explore will appear when you click the three dots button for selecting bitmap picture.

    Set picture on the image control


Properties for images.

The difference from the other images is these three images are not visible as a default.

These images will appear on imgYou or imgComp when you play the game.

    Properties for images2


Command buttons

Add three command buttons.

    Add command buttons


    Command button control


Properties for command buttons.

    Properties for command buttons


I will write a macro for next time.