- 繰り返しF4
- 書式のみコピー(繰り返し実行)ペンキマーク
- セルの書式設定Ctrl+1
- 書式設定・・・文字列、0埋め
- 現在日時表示Ctrl + +
- 現在時刻表示Ctrl + *
- セル内での改行Alt + Enter
- 折り返し表示ON/OFF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'本マクロを持ったブックの1シート目の情報を対象に繰り返しブックを開いて処理 | |
Sub M01_繰り返しブック開くサンプル() | |
Dim v読込行 As Integer | |
Const v読込開始列 As Integer = 1 | |
'読み込み開始位置の指定 | |
v読込行 = 1 | |
Dim vファイル名 As String | |
Dim v対象ブック As Workbook | |
Dim v保存用ブック As Workbook: Set v保存用ブック = ActiveWorkbook |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' VBA 基本操作 | |
'1.標準出力を知る(echo System.out.println() printf DBMS_OUTPUT.PUT() ) | |
MsgBox "画面に文字を出力します" | |
Debug.Print "VBAエディターのイミディエイトウィンドウに文字を出力します" | |
'2.文字列操作(文字列化、検索、置換、切抜、長さ) | |
文字列化 Str(数値) | |
検索 InStr([検索開始位置,]検索対象文字列,検索条件文字列[,検索方法]) | |
置換 Replace(文字列式,被置換文字列,置換文字列[,検索開始位置[,置換回数[,比較種別]]]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#KSHインデックス | |
# | |
# 新言語に出会ったらまずやること | |
# ■1.標準出力を知る(echo System.out.println() printf DBMS_OUTPUT.PUT() ) | |
# ■2.文字列操作(文字列化、検索、置換、切抜、長さ) | |
# ■3.条件 | |
# ■4.繰り返し | |
# ■5.ファイル操作(入出力) | |
# ■6.コメントの書き方(// -- rem # <!-- --> ) | |
# ■7.例外処理 |
IBMのDB、DB2には「db2batch」というベンチマーク・ツールがあります。
これはSQLの処理時間を計るツールです。
さらに複数SQLの測定や各種オプションがあるので開発〜テスト時に役立つかと思います。
例えばこんなものです。
以下は4回繰り返す例 => BGBLK
を使用します
--例)sample.sql というファイル
--#BGBLK 4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--■繰り返し文 | |
--1万回繰り返しINSERTする | |
BEGIN | |
FOR i IN 1..10000 LOOP | |
INSERT INTO TEST_TABLE VALUES(i,'TEST'||TO_CHAR(i)); | |
END LOOP; | |
COMMIT; | |
END; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'''''''''''''''''' | |
'1.選択範囲の内容をすべて消去 | |
'Clear メソッドで消去される内容は、値、数式、書式、コメント | |
'セルの全ての内容消去 | |
Cells(1,1).Clear | |
'1行目の内容消去 | |
Rows(1).Clear | |
'1列目の内容消去 | |
Columns(1).Clear |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'ハング誤認防止のため、ステータス表示 | |
Application.StatusBar = "処理実行中....(現在 出力情報編集中)" | |
'描画更新停止 | |
Application.ScreenUpdating = False | |
'''''''' | |
'処理記述 | |
'''''''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub getTableList() | |
Dim counter As Long : counter = 0 | |
Dim currentMaxRow As Long : currentMaxRow = 1 | |
Debug.Print Now & "copy start" | |
For Each i In Worksheets | |
'1シート目は集計用のシートのため除外 | |
If counter <> 0 Then | |
'コピーする最終行を取得 | |
With i.UsedRange | |
MaxRow = .Rows(.Rows.Count).Row |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub deleteBlankRow() | |
Debug.Print Now & "blank rows delete start" | |
Dim rng As Range | |
Dim r1 As Long 'ターゲット行 | |
Dim c1 As Long '開始列 | |
Dim c2 As Long '終了列 | |
Dim counter As Long | |
Dim deleteTargetRows As Range '削除する行集合 | |
r1 = 5000 | |
c1 = 1 |
OlderNewer