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 OutputToTextFile() | |
Const FILE_NAME = "\Output.txt" | |
Dim FSO As Object | |
Dim TS As Object |
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
'############################################################################## | |
'実行時間時間計測関連 | |
'############################################################################## | |
'ForDebug---------------------------------------------------------------------- | |
'時間計測 | |
Dim timeStart As Date | |
Dim timeEnd As Date |
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
'############################################################################## | |
'エクセルの動作一括制御 | |
'############################################################################## | |
'------------------------------------------------------------------------------ | |
'エクセルの自動機能停止 | |
'------------------------------------------------------------------------------ | |
'【引数】 |
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
'------------------------------------------------------------------------------- | |
'指定された名前のワークシートが存在するかの確認 | |
'------------------------------------------------------------------------------- | |
'【引数】対象ブック、検索するシート名 | |
'【戻り値】シートの存在の有無 | |
'【備考】 | |
Private Function HasSheet(wbTarget As Workbook, strSheetName As String) As Boolean | |
Dim sheet As Worksheet | |
Dim blnFlag As Boolean |
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
'------------------------------------------------------------------------------ | |
'新しいシートの名前を取得する | |
'------------------------------------------------------------------------------ | |
'【引数】新しいシートを作成するブック、シート名の初期値 | |
'【戻り値】ブックに重複のないシート名 | |
'【備考】シート名の初期値に重複がある場合は"(X)"を末尾に付ける。 | |
Private Function GetNewSheetName(wbTarget As Workbook, strSheetName As String) As String | |
Dim sheet As Worksheet | |
Dim intNumber As Integer | |
Dim strTmpName As String |
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
'------------------------------------------------------------------------------- | |
'列番号から列を表すアルファベットを取得する | |
'------------------------------------------------------------------------------- | |
'【引数】列番号 | |
'【戻り値】列を表すアルファベットの文字列 | |
'【備考】 | |
Private Function GetColumnAlphabet(intColumnNumber As Integer) As String | |
Dim strTmp As String | |
strTmp = Cells(1, intColumnNumber).Address |
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
'------------------------------------------------------------------------------- | |
'指定された列の、入力された最終行番号を取得する | |
'------------------------------------------------------------------------------- | |
'【引数】対象シート、対象の列番号 | |
'【戻り値】列番号 | |
'【備考】シートの下端から上方向に検索して、最初に値が入ったセルの行番号を返す。 | |
Private Function GetLastRowNumber(shtTarget As Worksheet, cnTarget As Integer) As Long | |
Dim rnMax As Long | |
Dim rnInputedLast As Long | |
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
'------------------------------------------------------------------------------- | |
'指定された行の、入力された最終列番号を取得する | |
'------------------------------------------------------------------------------- | |
'【引数】対象シート、対象の行番号 | |
'【戻り値】列番号 | |
'【備考】シートの右端から左方向に検索して、最初に値が入ったセルの列番号を返す。 | |
Private Function GetLastColNumber(shtTarget As Worksheet, lngRow As Long) As Integer | |
Dim intMaxCol As Integer | |
Dim intLastCol As Integer | |
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
'------------------------------------------------------------------------------ | |
'配列の新しいインデックス番号を返す | |
'------------------------------------------------------------------------------ | |
'【引数】配列(あるいはEmpty値のVariant型) | |
'【戻り値】long型 | |
'【備考】引数が配列ではないく、かつ初期化済みの場合は-1を返す。 | |
Private Function SetNewIndex(varArray As Variant) As Long | |
Dim lngNewIndex As Long | |
Dim index As Long | |
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
#!ruby -Ks | |
require 'win32ole' | |
wsh = WIN32OLE.new('WScript.Shell') | |
# | |
# 事前設定 | |
# | |
MACRO_FILE = "MacroFileName" | |
MACRO_NAME = "MacroName" |
OlderNewer