VBA¤Ç¥«¡¼¥É¥²¡¼¥à¤òºî¤ë¡¡
¿À·Ð¿ê¼å¥²¡¼¥à
¥æ¡¼¥¶¡¼¥Õ¥©¡¼¥à¥Ç¥¶¥¤¥ó
»ÈÍѤ·¤¿¥³¥ó¥È¥í¡¼¥ë¡¡¥³¥Þ¥ó¥É¥Ü¥¿¥ó¡¡¥Æ¥¥¹¥È¥Ü¥Ã¥¯¥¹¡¡¥¤¥á¡¼¥¸
¥³¥Þ¥ó¥É¥Ü¥¿¥ó¡¡£±¤Î¥×¥í¡¬¥Æ¥£¤Ç£ã£á£ð£ô£é£ï£î¤òCommandButton£±¤ò¾Ã¤·¤Æ¡Ö³Ð¤¨¤Æ¤Í¡×
¤Þ¤¿¤ÏCommandButton£±¤ò¤æ¤Ã¤¯¤ê¥¯¥ê¥Ã¥¯¤·¤Æ̾¾Î¤òÊѹ¹¡Ö³Ð¤¨¤Æ¤Í¡×
download¡¡¥Þ¥¯¥í¤ò͸ú¤Ë¤·¤ÆÆɤ߹þ¤à
Îý½¬£±¡¡ Image1_Click()¤ÎÍý²ò
Image1¤ò¥À¥Ö¥ë¥¯¥ê¥Ã¥¯¤·¤Æ ÀÖ»ú¤òÆþÎÏPrivate Sub Image1_Click()
Image1.Visible = False
Image1.Picture = Image15.Picture
Image1.Visible = True
End Sub
¼Â¹Ô
Ãí°Õ¡¡Image1.Visible = False¤òÀßÄꤷ¤Ê¤¤¤È²èÁü¤¬ÊѤï¤é¤Ê¤¤
Îý½¬£²¡¡ CommandButton1_Click()¤ÎÍý²ò
CommandButton1¤ò¥À¥Ö¥ë¥¯¥ê¥Ã¥¯¤·¤Æ
ÀÖ»ú¤òÆþÎÏ ¤³¤³¤Ç¤Ï¡Ö³Ð¤¨¤Æ¤Í¡×¤ò¥¯¥ê¥Ã¥¯
ÀèƬ¤Ëº£²ó»ÈÍѤ¹¤ëÊÑ¿ô¤òÀë¸À¤¹¤ë
Dim x, z, a(14), w, kotae, flag, y, miss, iq, ok, no
Private Sub CommandButton1_Click()
x = Int(Rnd() * 13 + 1)
disp2
Image1.Picture = Image29.Picture
End Sub
Sub disp2()
If x = 1 Then Image29.Picture = Image15.Picture
If x = 2 Then Image29.Picture = Image16.Picture
If x = 3 Then Image29.Picture = Image17.Picture
If x = 4 Then Image29.Picture = Image18.Picture
If x = 5 Then Image29.Picture = Image19.Picture
If x = 6 Then Image29.Picture = Image20.Picture
If x = 7 Then Image29.Picture = Image21.Picture
If x = 8 Then Image29.Picture = Image22.Picture
If x = 9 Then Image29.Picture = Image23.Picture
If x = 10 Then Image29.Picture = Image24.Picture
If x = 11 Then Image29.Picture = Image25.Picture
If x = 12 Then Image29.Picture = Image26.Picture
If x = 13 Then Image29.Picture = Image27.Picture
End Sub
¼Â¹Ô¡¡imag1 imag29¤Î£²¥«½ê¤Ë¥³¥Þ¥ó¥É¥Ü¥¿¥ó£±¤ò²¡¤¹¤¿¤Ó¤Ë¥é¥ó¥À¥à¤Ë¥È¥é¥ó¥×¤¬É½¼¨¤µ¤ì¤ë
Îý½¬£³¡¡Íð¿ô¤òÍøÍѤ·¤Æ¥È¥é¥ó¥×¤òʤ٤ë
ÀÄ»ú¤ò»Ä¤·¤ÆÀפò¾Ã¤·ÀÖ»ú¤òÆþ¤ì¤ë¡¡Æ±¤¸¤è¤¦¤Ê¥¹¥Æ¡¼¥È¥á¥ó¥È¤¬Â³¤¯¤Î¤Ç¥³¥Ô¡¼¤ò¤·¤Æ¿ôÃͤÀ¤±¤òÊѹ¹¤¹¤ë
Private Sub CommandButton1_Click()
w = 1
Do While w <= 13
x = Int(Rnd() * 13 + 1)
a(w) = x
w = w + 1
Loop
disp
End Sub
Sub disp()
x = a(1)
disp2
Image1.Picture = Image29.Picture
x = a(2)
disp2
Image2.Picture = Image29.Picture
x = a(3)
disp2
Image3.Picture = Image29.Picture
x = a(4)
disp2
Image4.Picture = Image29.Picture
x = a(5)
disp2
Image5.Picture = Image29.Picture
x = a(6)
disp2
Image6.Picture = Image29.Picture
x = a(7)
disp2
Image7.Picture = Image29.Picture
x = a(8)
disp2
Image8.Picture = Image29.Picture
x = a(9)
disp2
Image9.Picture = Image29.Picture
x = a(10)
disp2
Image10.Picture = Image29.Picture
x = a(11)
disp2
Image11.Picture = Image29.Picture
x = a(12)
disp2
Image12.Picture = Image29.Picture
x = a(13)
disp2
Image13.Picture = Image29.Picture
End Sub
Sub disp2()
If x = 1 Then Image29.Picture = Image15.Picture
If x = 2 Then Image29.Picture = Image16.Picture
If x = 3 Then Image29.Picture = Image17.Picture
If x = 4 Then Image29.Picture = Image18.Picture
If x = 5 Then Image29.Picture = Image19.Picture
If x = 6 Then Image29.Picture = Image20.Picture
If x = 7 Then Image29.Picture = Image21.Picture
If x = 8 Then Image29.Picture = Image22.Picture
If x = 9 Then Image29.Picture = Image23.Picture
If x = 10 Then Image29.Picture = Image24.Picture
If x = 11 Then Image29.Picture = Image25.Picture
If x = 12 Then Image29.Picture = Image26.Picture
If x = 13 Then Image29.Picture = Image27.Picture
End Sub
¼Â¹Ô¡¡Æ±¤¸¥«¡¼¥É¤¬½Ð¤Æ¤¯¤ë
Îý½¬£´¡¡Íð¿ô¤òÍøÍѤ·¤Æ¥È¥é¥ó¥×¤òʤ٤ëƱ¤¸¥«¡¼¥É¤¬½Ð¤Ê¤¤¤è¤¦¤Ë¤¹¤ë
ÀÄ»ú¤ò»Ä¤·¤ÆÀפò¾Ã¤·ÀÖ»ú¤òÆþ¤ì¤ë¡¡Æ±¤¸¤è¤¦¤Ê¥¹¥Æ¡¼¥È¥á¥ó¥È¤¬Â³¤¯¤Î¤Ç¥³¥Ô¡¼¤ò¤·¤Æ¿ôÃͤÀ¤±¤òÊѹ¹¤¹¤ë
Private Sub CommandButton1_Click()
For w = 1 To 13
a(w) = 0
Next w
w = 1
Do While w <= 13
x = Int(Rnd() * 13 + 1)
flag = 0
For y = 1 To 13
If a(y) = x Then flag = 1
Next y
If flag = 0 Then
a(w) = x
w = w + 1
End If
Loop
disp
End Sub
¼Â¹Ô¡¡Æ±¤¸¥«¡¼¥É¤¬½Ð¤Æ¤³¤Ê¤¤
¤³¤ì¤ÎÀâÌÀ¡¡³Æ¹àÌܤò¥»¥ë¤ËÂåÆþ¤·¤Æ¤ß¤Þ¤·¤ç¤¦
¼¡¤ÎÀÖ»ú¤òÄɲ䷤Ƽ¹ԡ¡¥»¥ë¤Î·ë²Ì¤ò¸«¤ë
Dim a(14), w, i, x
Private Sub CommandButton3_Click()
For w = 1 To 13
a(w) = 0
Next w
w = 1
Do While w <= 13
i = i + 1
x = Int(Rnd() * 13 + 1)
Cells(i, w) = x
flag = 0
For y = 1 To 13
If a(y) = x Then flag = 1
Next y
If flag = 0 Then
a(w) = x
w = w + 1
i = 0
End If
Loop
End Sub
ÎФΥ»¥ë¤ÏƱ¤¸Íð¿ô¤¬È¯À¸¤·¤¿¤¿¤á¡¢ºÆÅÙÍð¿ô¤òȯÀ¸¤·¤Æ¤¤¤ë
For y = 1 To 13
If a(y) = x Then flag = 1
Next y
Ʊ¤¸¿ôÃͤ¬ÇÛÎó¤ËÂåÆþ¤µ¤ì¤Æ¤¤¤¿¾ì¹çflag ÊÑ¿ô¤ò£±¤Ë¤·¤ÆÃΤ餻¤ë
£±¤Î»þ¤Ï¼¡¤Î¥¹¥Æ¡¼¥È¥á¥ó¥È¤¬¼Â¹Ô¤µ¤ì¤ºÍð¿ô¿ôÃͤÏÂåÆþ¤µ¤ì¤Ê¤¤
If flag = 0 Then
a(w) = x
w = w + 1