D0050.PDF

Similar documents
D0120.PDF

Lesson 1 1 EXVBA2000 Lesson01 Lesson01.xls 2

コンピュータ概論

コンピュータ概論

D0020.PDF

D0090.PDF

PowerPoint プレゼンテーション

untitled

1. 入力画面

PowerPoint プレゼンテーション

Excel Excel Excel = Excel ( ) 1

My関数の作成演習問題集

94 expression True False expression FalseMSDN IsNumber WorksheetFunctionIsNumberexpression expression True Office support.office.com/ja-jp/ S

untitled

45 VBA Fortran, Pascal, C Windows OS Excel VBA Visual Basic Excel VBA VBA Visual Basic For Application Microsoft Office Office Excel VBA VBA Excel Acc

Excel Excel Excel = Excel III 7 ( ) 1

B 5 (2) VBA R / B 5 ( ) / 34

Microsoft Word - VBA基礎(3).docx

2 X Y Y X θ 1,θ 2,... Y = f (X,θ 1,θ 2,...) θ k III 8 ( ) 1 / 39

ii

情報基礎A

Microsoft PowerPoint - Visualプログラミング

1. 入力画面

AccessVBA−‹ŠpŁÒ-flO“Z

sinfI2005_VBA.doc


プレポスト【問題】

の包絡線を求めることになる 包絡線は一次式で表せるのでこのときの係数 ( 切片 ) を求 めればよいことになる この係数 ( 切片 ) が粘着力となる 包絡線はモールの応力円に外 接する直線であるため 包絡線の式は下記三式を解くことにより求めることができる 包絡線の式 Y=A1 X + B1 ---

.NETプログラマー早期育成ドリル ~VB編 付録 文法早見表~

PowerPoint プレゼンテーション

CommandMatrix_8230E

カレンダー講座メモ

ThisWorkbook のコード 'アドイン 登 録 Private Sub Workbook_AddinInstall() Set Menu = Application.CommandBars("Worksheet Menu Bar").Controls.Add(Type:=msoControl

Excel ダッシュボードのご紹介 株式会社アイエルアイ総合研究所内藤慶一

08‘͆i”O“Z†j

バスケットボール

2X Y Y X θ 1, θ 2,... Y = f(x, θ 1, θ 2,...) θ k III 8 ( ) 1 / 39

MS-ExcelVBA 基礎 (Visual Basic for Application)

(18,26) 10/ GHz.xls [ (18GHz) ] GHz.xls [ (26GHz) ] +----all.sh [ 2 10 ] +----mesure-ryudai/ / _csv.log [

Excel ではじめる数値解析 サンプルページ この本の定価 判型などは, 以下の URL からご覧いただけます. このサンプルページの内容は, 初版 1 刷発行時のものです.

情報資源組織演習B:

BASICとVisual Basic

Microsoft Word 練習問題の解答.doc

saihata.doc

[Excelが自動化するVBAの魔法2]購入者限定テキスト

untitled

卒業論文.PDF

ExcelVBA 10m (10m ) (10m ) km m 15 3km 4km 1 CD-ROM ExcelVBA Excel Excel - 2 -

ブロック パニック

VBM01#解答解説# indd


2013 年 8 月 14 日 管理図作成マニュアル ( 案 ) 益永八尋 Ⅰ. プログラムの概要 品質管理において必要な QC7 道具の一つである管理図作成のプログラムを作成した このプログラムは 下記の管理図を作成するものである 1 BerX-R 管理図 2Me 管理図 3X 管理図 4np 管

PowerPoint プレゼンテーション

2 1 F M m r G F = GMm r 2 (1.1) (1.1) (r = r ) F = GMmr r 3 (1.2) a F m F = kma k 1 F = ma (1.3) (1.2) (1.3) ma = GMmr r 3 (1.4)

6.1 工 程 管 理 (ネットワーク 工 程 表 ) 159 VBA( 実 行 結 果 例 ) 出 力 結 果 シート 出 力 結 果 を 図 に 描 くと 下 図 のようになる. 図 6.3 ネットワーク 工 程 表 ( 出 力 結 果 より 作 図 )

untitled

Koblitz Miller field Fp p prime field Fp E Fp Fp Hasse Weil 2.2 Fp 2 P Q R R P Q O P O R Q Q O R P P xp, yp Q xq, yq yp yq R=O

PowerPoint プレゼンテーション

Microsoft Word - 課題1_2.doc

OS Windows Mac OS Windows Mac OS Windows XP Mac OS X OS Windows 95 Mac OS

方程式の解法

PR300 電力モニタ 通信インタフェース (RS-485通信,Ethernet通信)

xl 1 program Othello6; 2 {$APPTYPE CONSOLE} 3 uses SysUtils; 4 5 type 6 TMasuNo = 0..99; // 7 TYouso = (Soto,Kara,Kuro,Siro); // 8 TBan = array [TMasu

Microsoft PowerPoint - VBA解説1.ppt [互換モード]

ケミカルエンジニアのためのExcelを用いた化学工学計算法

PowerPoint プレゼンテーション

PowerPoint プレゼンテーション

<4D F736F F D208DEC90AC837D836A B81698F4390B394C5816A2E646F63>

橡vb_kikai0.PDF

ExcelVBA Excel VBA Microsoft Excel VBA Visual Basic for Applications Excel Excel VBA ExcelVBA Excel ExcelVBA Excel VBA Excel ExcelVBA ExcelVBA VBA Ran

技術ノート KGTN

第10回 コーディングと統合(WWW用).PDF

Case 0 sqlcmdi.parameters("?tencode").value = Iidata(0) sqlcmdi.parameters("?tenname").value = Iidata(1) 内容を追加します sqlcmdi.executenonquery() Case Else

(Microsoft Word \203v\203\215\203O\203\211\203~\203\223\203O)

LogisticaTRUCKServer-Ⅱ距離計算サーバ/Active-Xコントロール/クライアント 概略   

一般的なプログラムの実行


橡WINAPLI.PDF

ルーレットプログラム

リスト ボックス (ListBox) コントロール、List プロパティの使用例

Microsoft PowerPoint - vp演習課題

EXCEL VBA講座

ブロック崩し風テニス

Appendix A BASIC BASIC Beginner s All-purpose Symbolic Instruction Code FORTRAN COBOL C JAVA PASCAL (NEC N88-BASIC Windows BASIC (1) (2) ( ) BASIC BAS


表紙

ケミカルエンジニアのためのExcelを用いた化学工学計算法

.AddItem " 埼 玉 ":.AddItem " 茨 城 ":.AddItem " 栃 木 ":.AddItem " 群 馬 ".AddItem " 山 梨 ":.AddItem " 静 岡 ":.AddItem " 岐 阜 ":.AddItem " 愛 知 ".AddItem " 三 重 "

Microsoft Word - ExcelVBA.doc

LogisticaTRUCKServer-Ⅱ距離計算サーバ/Active-Xコントロール/クライアント 概略   

回文作成支援プログラム

L N P Y F C T V W Z I X Pentomino Form Name Caption Position FormMain podesktopcenter

ver VBA 超簡単テキスト このテキストは Visual Basic の学習を目的に作られたExcelVBA 学習テキストである そのため Excel が持つ表計算ソフトとしての機能よりも GUI を活用したアプリケーション開発に重点をおいている このテキストを通して GUI アプ

74 No ACCESS

最初に VBA が使用できるように マクロ と呼ばれるエクセル上のアプリ ( のようなもの ) を準備します Excel メニューの ファイル オプション を選択 表示される Excel のオプション から リボンのユーザー設定 を選択 メインタブ 内の 開発 にチェックを付けて OK をクリック

B Simon (Trump ) SimonU.pas SimonP.dpr Name FormSimon Caption Position podesktopcenter uses Windows, Messages, SysUtils,

VBAfiüŒåŁÒver2

(Microsoft Word - \220S\227\235\212w\202\314\202\275\202\337\202\314ExcelVBA.doc)


情報科学概論 第1回資料

Transcription:

Excel VBA 6 3 3 1 Excel BLOCKGAME.xls Excel 1 OK 2 StepA D B1 B4 C1 C2 StepA StepA Excel Workbook Open StepD BLOCKGAME.xls VBEditor ThisWorkbook 3 1

1 2 2

3 5 UserForm1 4 6 UsorForm2 StepB 3 StepC StepD SetpD StepA Workbook BeforeClose BLOCKGAME_S1.xls UI BLOCKGAME_S1.xls Sheet1 5 Excel 4 3

VBEditor UserForm1 UserFom2 5 6 1 2 Step 1 1 1 BlockGame 2 1 1 2 Public 2 GameEnd False ChallgNo 1 1 Sub BlockGame() Dim i As Integer Dim myrange As Range ' GameEnd = False ChallgNo = 1 B1 ' UserForm1.Show If GameEnd = True Then Exit Sub ' s_blockclear ' B3 s_blockdraw ' s_problem ' B4 B2 Do UserForm2.Show ' Loop Until GameEnd = True ' Range("BlockP").EntireColumn.Hidden = False C1.2 C3 4

UserFom1 2 Initialize 7 7 2 UserForml Private Sub UserForm_Initialize() Dim myspn As MSForms.SpinButton Dim myimg As MSForms.Image Dim i As Integer ' With UserForm2.StartUpPosition = 0.Left = Application.Left + 400.Top = Application.Top + 100 End With For i = 1 To BlockMNo ' Set myspn = UserForm2.Controls("Spinbutton" & i) With myspn.max = ColorNo + 1.Min = 0.Value = 1 End With ' Set myimg = UserForm2.Controls("Image" & i) If ChallgNo = 1 Then myimg.tag = i myimg.backcolor = f_setrgbcolor(i) Else '2 myimg.tag = Cells(8 - i, (ChallgNo - 2) * 2 + 4).Interior.ColorIndex myimg.backcolor = f_setrgbcolor(myimg.tag) ' For i = BlockMNo + 1 To 5 UserForm2.Controls("Spinbutton" & i).visible = False UserForm2.Controls("Image" & i).visible = False 5

UserFom1 Value True Value GameEnd True 3 3 s_blockclear s_blockdraw 1 B3 2 3 Union Union 5 3 '***** Sub s_blockclear() Dim myrange As Range Set myrange = Union(Range("Block5"), Range("BlockP")) With myrange.clear.borders(xledgeleft).linestyle = xlnone.borders(xledgetop).linestyle = xlnone.borders(xledgebottom).linestyle = xlnone.borders(xledgeright).linestyle = xlnone.borders(xlinsidehorizontal).linestyle = xlnone.interior.colorindex = xlnone End With Range("BlockC").ClearContents '***** Sub s_blockdraw() Dim myrange As Range Set myrange = Union(Range("Block" & BlockMNo), _ Range("BlockP").Offset(5 - BlockMNo).Resize(BlockMNo)) With myrange.borders(xledgeleft).linestyle = xlcontinuous.borders(xledgetop).linestyle = xlcontinuous.borders(xledgebottom).linestyle = xlcontinuous.borders(xledgeright).linestyle = xlcontinuous.borders(xlinsidehorizontal).linestyle = xlcontinuous End With 6

s_problem s_problem f_setcolor 4 4 4 Sub s_problem() Dim i As Integer ' Range("BlockP").EntireColumn.Hidden = True ' For i = 1 To BlockMNo Cells(8 - i, 1).Interior.ColorIndex = f_setcolor(i) '***** NO Function f_setcolor(blockno As Integer) Dim i As Integer Dim mycolor As Integer ' Dim myflg As Boolean If BlockNo = 1 Then '1 Randomize f_setcolor = Int(ColorNo * Rnd + 1) Else '2 Do myflg = False Randomize mycolor = Int(ColorNo * Rnd + 1) For i = 1 To BlockNo - 1 If mycolor = Cells(8 - i, 1).Interior.ColorIndex Then myflg = True: Exit For Loop While myflg = True f_setcolor = mycolor End Function 7

UserForm1 UserFom2 5 1 2 3 4 3 5 UserForm2 5 5 UserForm2 Option Explicit Option Base 1 '***** Private Sub UserForm_Initialize() Dim myspn As MSForms.SpinButton Dim myimg As MSForms.Image Dim i As Integer ' With UserForm2.StartUpPosition = 0.Left = Application.Left + 400.Top = Application.Top + 100 End With For i = 1 To BlockMNo ' Set myspn = UserForm2.Controls("Spinbutton" & i) With myspn.max = ColorNo + 1.Min = 0.Value = 1 End With ' Set myimg = UserForm2.Controls("Image" & i) If ChallgNo = 1 Then myimg.tag = i myimg.backcolor = f_setrgbcolor(i) Else '2 myimg.tag = Cells(8 - i, (ChallgNo - 2) * 2 + 4).Interior.ColorIndex myimg.backcolor = f_setrgbcolor(myimg.tag) ' For i = BlockMNo + 1 To 5 UserForm2.Controls("Spinbutton" & i).visible = False UserForm2.Controls("Image" & i).visible = False '***** RGB Function f_setrgbcolor(myidx As Integer) As Long Dim mycol As Long Select Case myidx Case 1: mycol = RGB(0, 0, 0) ' Case 2: mycol = RGB(255, 255, 255) ' Case 3: mycol = RGB(255, 0, 0) ' Case 4: mycol = RGB(0, 255, 0) ' Case 5: mycol = RGB(0, 0, 255) ' Case 6: mycol = RGB(255, 255, 0) ' Case 7: mycol = RGB(255, 0, 255) ' Case 8: mycol = RGB(0, 255, 255) ' End Select f_setrgbcolor = mycol End Function 8

1 5 4 1 6 1 6 1 6 7 Change Change 6 2 5 Colorlndex RGB f_setrgbcolor Tag Change 6 UserForm2 ExcelVBA BLOCKGAME.xls 6 '***** Private Sub SpinButton1_Change() ' Select Case SpinButton1.Value Case 0: SpinButton1.Value = ColorNo Case ColorNo + 1: SpinButton1.Value = 1 End Select ' Image1.BackColor = f_setrgbcolor(spinbutton1.value) Image1.Tag = SpinButton1.Value 9

[ ] [ ] UserFom2 7 7 mycolor 1 mycolor 2 False True 5 UserForm2 OptionBase 1 0 s_check GameEnd True 10

7 '***** Private Sub CommandButton1_Click() Dim myimg As MSForms.Image Dim i As Integer Dim mycolor(8) As Boolean ' For i = 1 To BlockMNo Set myimg = UserForm2.Controls("Image" & i) If mycolor(myimg.tag) = True Then MsgBox " ": Exit Sub Else Cells(8 - i, (ChallgNo - 1) * 2 + 4).Interior.ColorIndex = myimg.tag mycolor(myimg.tag) = True s_check Unload Me '***** Private Sub CommandButton2_Click() GameEnd = True ' Unload Me '***** Sub s_check() Dim i As Integer, j As Integer ' For i = 1 To BlockMNo For j = 1 To BlockMNo If Cells(8 - i, 1).Interior.ColorIndex = _ Cells(8 - j, (ChallgNo - 1) * 2 + 4).Interior.ColorIndex Then If i = j Then Cells(9, (ChallgNo - 1) * 2 + 4).Value = Cells(9, (ChallgNo - 1) * 2 + 4).Value + 1 Else Cells(10, (ChallgNo - 1) * 2 + 4).Value = Cells(10, (ChallgNo - 1) * 2 + 4).Value + 1 Exit For ' If Cells(9, (ChallgNo - 1) * 2 + 4).Value = BlockMNo Then MsgBox " " GameEnd = True ElseIf ChallgNo = 8 Then MsgBox " " GameEnd = True ChallgNo = ChallgNo + 1 ' 11

6 3 20 3 6 20 6 120 6720 12

13